Compare commits

..

1 Commits

4469 changed files with 16700 additions and 87212 deletions

View File

@@ -1,159 +0,0 @@
# See www/CMake.html for instructions on how to build libcxx with CMake.
#===============================================================================
# Setup Project
#===============================================================================
project(libcxx CXX C)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME libcxx)
set(PACKAGE_VERSION trunk-svn)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
)
# Require out of source build.
include(MacroEnsureOutOfSourceBuild)
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
"${PROJECT_NAME} requires an out of source build. Please create a separate
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
)
#===============================================================================
# Setup CMake Options
#===============================================================================
# Define options.
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
#===============================================================================
# Configure System
#===============================================================================
# Get triples.
include(GetTriple)
get_host_triple(LIBCXX_HOST_TRIPLE
LIBCXX_HOST_ARCH
LIBCXX_HOST_VENDOR
LIBCXX_HOST_OS
)
set(LIBCXX_HOST_TRIPLE ${LIBCXX_HOST_TRIPLE} CACHE STRING "Host triple.")
get_target_triple(LIBCXX_TARGET_TRIPLE
LIBCXX_TARGET_ARCH
LIBCXX_TARGET_VENDOR
LIBCXX_TARGET_OS
)
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
# Configure compiler.
include(config-ix)
#===============================================================================
# Setup Compiler Flags
#===============================================================================
# Get required flags.
# On all systems the system c++ standard library headers need to be excluded.
if (MSVC)
# MSVC only has -X, which disables all default includes; including the crt.
# Thus, we do nothing and hope we don't accidentally include any of the C++
# headers.
else()
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
set(LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
endif()
if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
endif()
endif()
macro(append_if list condition var)
if (${condition})
list(APPEND ${list} ${var})
endif()
endmacro()
# Get warning flags
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
if (LIBCXX_ENABLE_WERROR)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
endif()
if (LIBCXX_ENABLE_PEDANTIC)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
endif()
# Get feature flags.
# Exceptions
if (LIBCXX_ENABLE_EXCEPTIONS)
# Catches C++ exceptions only and tells the compiler to assume that extern C
# functions never throw a C++ exception.
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
else()
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
endif()
# RTTI
if (NOT LIBCXX_ENABLE_RTTI)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
endif()
# Assert
if (LLVM_ENABLE_ASSERTIONS)
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
if (NOT MSVC)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
endif()
# On Release builds cmake automatically defines NDEBUG, so we
# explicitly undefine it:
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG)
endif()
else()
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
endif()
endif()
# This is the _ONLY_ place where add_definitions is called.
add_definitions(
${LIBCXX_CXX_REQUIRED_FLAGS}
${LIBCXX_CXX_WARNING_FLAGS}
${LIBCXX_CXX_FEATURE_FLAGS}
)
#===============================================================================
# Setup Source Code
#===============================================================================
include_directories(include)
# Add source code. This also contains all of the logic for deciding linker flags
# soname, etc...
add_subdirectory(lib)
#===============================================================================
# Setup Tests
#===============================================================================
add_subdirectory(test)

View File

@@ -1,18 +0,0 @@
This file is a partial list of people who have contributed to the LLVM/libc++
project. If you have contributed a patch or made some other contribution to
LLVM/libc++, please submit a patch to this file to add yourself, and it will be
done!
The list is sorted by surname and formatted to allow easy grepping and
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
(S).
N: Howard Hinnant
E: hhinnant@apple.com
D: Architect and primary author of libc++
N: Marshall Clow
E: marshall@idio.com
E: mclow@qualcomm.com
D: Minor patches and bug fixes.

View File

@@ -1,21 +1,10 @@
==============================================================================
libc++ License
LLVM Release License
==============================================================================
The libc++ library is dual licensed under both the University of Illinois
"BSD-Like" license and the MIT license. As a user of this code you may choose
to use it under either license. As a contributor, you agree to allow your code
to be used under both.
Full text of the relevant licenses is included below.
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
Copyright (c) 2007-2010 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
@@ -54,23 +43,21 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
The LLVM software contains code written by third parties. Such software will
have its own individual LICENSE.TXT file in the directory in which it appears.
This file will describe the copyrights, license, and restrictions which apply
to that code.
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
The disclaimer of warranty in the University of Illinois Open Source License
applies to all code in the LLVM Distribution, and nothing in any of the
other licenses gives permission to use the names of the LLVM Team or the
University of Illinois to endorse or promote products derived from this
Software.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The following pieces of software have additional or alternate copyrights,
licenses, and/or restrictions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Program Directory
------- ---------
<none yet>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -9,16 +9,10 @@ OBJROOT=.
SYMROOT=.
export TRIPLE=-apple-
ifeq (,$(RC_INDIGO))
INSTALL_PREFIX=""
else
INSTALL_PREFIX="$(SDKROOT)"
endif
installsrc:: $(SRCROOT)
ditto $(SRCDIRS)/include $(SRCROOT)/include
ditto $(SRCDIRS)/lib $(SRCROOT)/lib
ditto $(SRCDIRS)/lib/buildit $(SRCROOT)/lib/buildit
ditto $(SRCDIRS)/src $(SRCROOT)/src
ditto $(SRCDIRS)/Makefile $(SRCROOT)/Makefile
@@ -26,19 +20,21 @@ clean::
installhdrs::
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/include
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext/*
mkdir -p $(DSTROOT)/usr/include/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/usr/include
chmod 755 $(DSTROOT)/usr/include/c++/v1
chmod 644 $(DSTROOT)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/usr/include/c++/v1/ext/*
install:: installhdrs $(DESTDIR)
cd lib && ./buildit
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib
strip -S -o $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib && ln -s libc++.1.dylib libc++.dylib
mkdir -p $(DSTROOT)/usr/lib
strip -S -o $(DSTROOT)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd $(DSTROOT)/usr/lib && ln -s libc++.1.dylib libc++.dylib

View File

@@ -1,53 +0,0 @@
# Define functions to get the host and target triple.
function(get_host_triple out out_arch out_vendor out_os)
# Get the architecture.
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
if (arch STREQUAL "x86")
set(arch "i686")
endif()
# Get the vendor.
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
set(vendor "apple")
else()
set(vendor "pc")
endif()
# Get os.
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(os "win32")
else()
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} os)
endif()
set(triple "${arch}-${vendor}-${os}")
set(${out} ${triple} PARENT_SCOPE)
set(${out_arch} ${arch} PARENT_SCOPE)
set(${out_vendor} ${vendor} PARENT_SCOPE)
set(${out_os} ${os} PARENT_SCOPE)
message(STATUS "Host triple: ${triple}")
endfunction()
function(get_target_triple out out_arch out_vendor out_os)
# Get the architecture.
set(arch ${CMAKE_SYSTEM_PROCESSOR})
if (arch STREQUAL "x86")
set(arch "i686")
endif()
# Get the vendor.
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(vendor "apple")
else()
set(vendor "pc")
endif()
# Get os.
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(os "win32")
else()
string(TOLOWER ${CMAKE_SYSTEM_NAME} os)
endif()
set(triple "${arch}-${vendor}-${os}")
set(${out} ${triple} PARENT_SCOPE)
set(${out_arch} ${arch} PARENT_SCOPE)
set(${out_vendor} ${vendor} PARENT_SCOPE)
set(${out_os} ${os} PARENT_SCOPE)
message(STATUS "Target triple: ${triple}")
endfunction()

View File

@@ -1,18 +0,0 @@
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage )
string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource )
if( _insource )
message( SEND_ERROR "${_errorMessage}" )
message( FATAL_ERROR
"In-source builds are not allowed.
CMake would overwrite the makefiles distributed with Compiler-RT.
Please create a directory and run cmake from there, passing the path
to this source directory as the last argument.
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
Please delete them."
)
endif( _insource )
endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD )

View File

@@ -1,38 +0,0 @@
include(CheckLibraryExists)
include(CheckCXXCompilerFlag)
# Check compiler flags
check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG)
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG)
check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
# Check libraries
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
# Check C++0x features
if (LIBCXX_ENABLE_CXX0X)
if (LIBCXX_HAS_STDCXX0X_FLAG)
set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x)
endif()
else()
set(LIBCXX_HAS_STDCXX0X_FLAG FALSE)
endif()

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -50,7 +50,7 @@ public:
*__seg_ &= ~__mask_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__bit_reference& operator=(const __bit_reference& __x) {return operator=(static_cast<bool>(__x));}
@@ -1028,7 +1028,6 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la
}
template <class _C, bool _IC1, bool _IC2>
inline _LIBCPP_INLINE_VISIBILITY
bool
equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2)
{
@@ -1075,14 +1074,14 @@ public:
}
return *this;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator operator++(int)
{
__bit_iterator __tmp = *this;
++(*this);
return __tmp;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator& operator--()
{
if (__ctz_ != 0)
@@ -1094,14 +1093,14 @@ public:
}
return *this;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator operator--(int)
{
__bit_iterator __tmp = *this;
--(*this);
return __tmp;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator& operator+=(difference_type __n)
{
if (__n >= 0)
@@ -1113,19 +1112,19 @@ public:
__ctz_ = static_cast<unsigned>((__n + __ctz_) % __bits_per_word);
return *this;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator& operator-=(difference_type __n)
{
return *this += -__n;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator operator+(difference_type __n) const
{
__bit_iterator __t(*this);
__t += __n;
return __t;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator operator-(difference_type __n) const
{
__bit_iterator __t(*this);

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -26,31 +26,15 @@
#if __LITTLE_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 1
#define _LIBCPP_BIG_ENDIAN 0
#endif // __LITTLE_ENDIAN__
#endif // __LITTLE_ENDIAN__
#endif
#endif
#ifdef __BIG_ENDIAN__
#if __BIG_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 0
#define _LIBCPP_BIG_ENDIAN 1
#endif // __BIG_ENDIAN__
#endif // __BIG_ENDIAN__
#ifdef __FreeBSD__
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# else // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
#endif // __FreeBSD__
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
#endif // _WIN32
#endif
#endif
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h>
@@ -60,10 +44,10 @@
# elif __BYTE_ORDER == __BIG_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# else // __BYTE_ORDER == __BIG_ENDIAN
# else
# error unable to determine endian
# endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
#endif
#ifndef _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_VISIBILITY_TAG 1
@@ -72,10 +56,10 @@
#if _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
#else // _LIBCPP_VISIBILITY_TAG
#else
#define _LIBCPP_HIDDEN
#define _LIBCPP_VISIBLE
#endif // _LIBCPP_VISIBILITY_TAG
#endif
#ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
@@ -87,154 +71,41 @@
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
#if defined(__clang__)
//#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
//#endif
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#ifdef __linux__
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#else
typedef __char16_t char16_t;
typedef __char32_t char32_t;
#endif
#endif
#if !(__has_feature(cxx_exceptions))
#define _LIBCPP_NO_EXCEPTIONS
#endif
#if !(__has_feature(cxx_rtti))
#define _LIBCPP_NO_RTTI
#endif
#if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE
#endif
#if !(__has_feature(cxx_attributes))
#define _LIBCPP_HAS_NO_ATTRIBUTES
#endif
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif // !(__has_feature(cxx_deleted_functions))
#if !(__has_feature(cxx_lambdas))
#define _LIBCPP_HAS_NO_LAMBDAS
#endif
#if !(__has_feature(cxx_nullptr))
#define _LIBCPP_HAS_NO_NULLPTR
#endif
#if !(__has_feature(cxx_rvalue_references))
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#if !(__has_feature(cxx_static_assert))
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
#if !(__has_feature(cxx_auto_type))
#define _LIBCPP_HAS_NO_AUTO_TYPE
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
#if !(__has_feature(cxx_variadic_templates))
#define _LIBCPP_HAS_NO_VARIADICS
#endif
#if !(__has_feature(cxx_trailing_return))
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#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 _STD std::_LIBCPP_NAMESPACE
namespace std {
inline namespace _LIBCPP_NAMESPACE {
}
}
#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
#if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
// end defined(__clang__)
#elif defined(__GNUC__)
#if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS
#endif
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#else // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
#define _LIBCPP_MOVE
#endif
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
#define _LIBCPP_HAS_NO_NULLPTR
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_DECLTYPE
#endif
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
#endif // __GXX_EXPERIMENTAL_CXX0X__
#if defined(__clang__)
#define _LIBCPP_HAS_NO_STRONG_USING
#endif
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#ifdef _LIBCPP_HAS_NO_STRONG_USING
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
#define _STD std
#else
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _STD std::_LIBCPP_NAMESPACE
namespace std {
namespace _LIBCPP_NAMESPACE {
@@ -242,12 +113,13 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}
#endif // defined(__GNUC__)
#define _STD std::_LIBCPP_NAMESPACE
#endif
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
typedef unsigned int char32_t;
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
typedef unsigned int char32_t;
#endif
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
@@ -258,18 +130,16 @@ template <unsigned> struct __static_assert_check {};
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
_LIBCPP_CONCAT(__t, __LINE__)
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
#ifdef _LIBCPP_HAS_NO_DECLTYPE
#define decltype(x) __typeof__(x)
#endif
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
#define constexpr const
#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS
#endif
#endif // _LIBCPP_CONFIG

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,21 +21,21 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
struct _LIBCPP_VISIBLE unary_function
struct unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
template <class _Arg1, class _Arg2, class _Result>
struct _LIBCPP_VISIBLE binary_function
struct binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
template <class _Tp> struct _LIBCPP_VISIBLE hash;
template <class _Tp> struct hash;
template <class _Tp>
struct __has_result_type
@@ -281,55 +281,161 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
// __invoke
// bullets 1 and 2
// first bullet
template <class _F, class _A0, class ..._Args>
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_STD::forward<_A0>(__a0).*__f)(_STD::forward<_Args>(__args)...))
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
{
return (_STD::forward<_A0>(__a0).*__f)(_STD::forward<_Args>(__args)...);
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _F, class _A0, class ..._Args>
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_STD::forward<_A0>(__a0)).*__f)(_STD::forward<_Args>(__args)...))
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_A0>(__a0)).*__f)(_STD::forward<_Args>(__args)...);
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
// bullets 3 and 4
template <class _F, class _A0>
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0)
-> decltype(_STD::forward<_A0>(__a0).*__f)
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{
return _STD::forward<_A0>(__a0).*__f;
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _F, class _A0>
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0)
-> decltype((*_STD::forward<_A0>(__a0)).*__f)
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{
return (*_STD::forward<_A0>(__a0)).*__f;
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
// bullet 5
// second bullet
template <class _F, class ..._Args>
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _Args&& ...__args)
-> decltype(_STD::forward<_F>(__f)(_STD::forward<_Args>(__args)...))
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
{
return _STD::forward<_F>(__f)(_STD::forward<_Args>(__args)...);
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
// third bullet
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_base_of<_T, typename remove_reference<_T1>::type>::value,
typename __apply_cv<_T1, _R>::type&&
>::type
__invoke(_R _T::* __f, _T1&& __t1)
{
return _STD::forward<_T1>(__t1).*__f;
}
// forth bullet
template <class _T1, class _R, bool>
struct __4th_helper
{
};
template <class _T1, class _R>
struct __4th_helper<_T1, _R, true>
{
typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
};
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename __4th_helper<_T1, _R,
!is_base_of<_T,
typename remove_reference<_T1>::type
>::value
>::type&&
__invoke(_R _T::* __f, _T1&& __t1)
{
return (*_STD::forward<_T1>(__t1)).*__f;
}
// fifth bullet
template <class _F, class ..._T>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_T...)>::type
__invoke(_F&& __f, _T&& ...__t)
{
return _STD::forward<_F>(__f)(_STD::forward<_T>(__t)...);
}
template <class _Tp, class ..._Args>
@@ -339,7 +445,7 @@ struct __invoke_return
};
template <class _Tp>
class _LIBCPP_VISIBLE reference_wrapper
class reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@@ -351,7 +457,7 @@ private:
public:
// construct/copy/destroy
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) : __f_(&__f) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
#endif
@@ -361,8 +467,7 @@ public:
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_of<type&, _ArgTypes...>::type
typename __invoke_return<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
return __invoke(get(), _STD::forward<_ArgTypes>(__args)...);
@@ -406,20 +511,10 @@ cref(reference_wrapper<_Tp> __t)
return cref(__t.get());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&& __t) = delete;
template <class _Tp> void cref(const _Tp&& __t) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&& __t);// = delete;
template <class _Tp> void cref(const _Tp&& __t);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp> void ref(const _Tp&& __t);// = delete; // LWG 688
template <class _Tp> void cref(const _Tp&& __t);// = delete; // LWG 688
#endif
#endif // _LIBCPP_HAS_NO_VARIADICS

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -235,84 +235,84 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile>
// __invoke
// __ref_return0
//
//
// template <class _Tp, bool _HasResultType>
// struct ________ref_return0 // _HasResultType is true
// {
// typedef typename _Tp::result_type type;
// };
//
//
// template <class _Tp>
// struct ________ref_return0<_Tp, false>
// {
// typedef void type;
// };
//
//
// template <class _Tp, bool _IsClass>
// struct ____ref_return0 // _IsClass is true
// : public ________ref_return0<_Tp, __has_result_type<typename remove_cv<_Tp>::type>::value>
// {
// };
//
//
// template <class _Tp, bool _HasResultType>
// struct ______ref_return0 // _HasResultType is true
// {
// typedef typename __callable_type<_Tp>::result_type type;
// };
//
//
// template <class _Tp>
// struct ______ref_return0<_Tp, false> // pointer to member data
// {
// typedef void type;
// };
//
//
// template <class _Tp>
// struct ____ref_return0<_Tp, false>
// : public ______ref_return0<typename remove_cv<_Tp>::type,
// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value>
// {
// };
//
//
// template <class _Tp>
// struct __ref_return0
// : public ____ref_return0<typename remove_reference<_Tp>::type,
// is_class<typename remove_reference<_Tp>::type>::value>
// {
// };
//
//
// __ref_return1
//
//
// template <class _Tp, bool _IsClass, class _A0>
// struct ____ref_return1 // _IsClass is true
// {
// typedef typename result_of<_Tp(_A0)>::type type;
// };
//
//
// template <class _Tp, bool _HasResultType, class _A0>
// struct ______ref_return1 // _HasResultType is true
// {
// typedef typename __callable_type<_Tp>::result_type type;
// };
//
//
// template <class _Tp, class _A0, bool>
// struct __ref_return1_member_data1;
//
//
// template <class _R, class _C, class _A0>
// struct __ref_return1_member_data1<_R _C::*, _A0, true>
// {
// typedef typename __apply_cv<_A0, _R>::type& type;
// };
//
//
// template <class _R, class _C, class _A0>
// struct __ref_return1_member_data1<_R _C::*, _A0, false>
// {
// static _A0 __a;
// typedef typename __apply_cv<decltype(*__a), _R>::type& type;
// };
//
//
// template <class _Tp, class _A0>
// struct __ref_return1_member_data;
//
//
// template <class _R, class _C, class _A0>
// struct __ref_return1_member_data<_R _C::*, _A0>
// : public __ref_return1_member_data1<_R _C::*, _A0,
@@ -320,90 +320,90 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile>
// typename remove_cv<typename remove_reference<_A0>::type>::type>::value>
// {
// };
//
//
// template <class _Tp, class _A0>
// struct ______ref_return1<_Tp, false, _A0> // pointer to member data
// : public __ref_return1_member_data<typename remove_cv<_Tp>::type, _A0>
// {
// };
//
//
// template <class _Tp, class _A0>
// struct ____ref_return1<_Tp, false, _A0>
// : public ______ref_return1<typename remove_cv<_Tp>::type,
// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value, _A0>
// {
// };
//
//
// template <class _Tp, class _A0>
// struct __ref_return1
// : public ____ref_return1<typename remove_reference<_Tp>::type,
// is_class<typename remove_reference<_Tp>::type>::value, _A0>
// {
// };
//
//
// __ref_return2
//
//
// template <class _Tp, bool _IsClass, class _A0, class _A1>
// struct ____ref_return2 // _IsClass is true
// {
// typedef typename result_of<_Tp(_A0, _A1)>::type type;
// };
//
//
// template <class _Tp, bool _HasResultType, class _A0, class _A1>
// struct ______ref_return2 // _HasResultType is true
// {
// typedef typename __callable_type<_Tp>::result_type type;
// };
//
//
// template <class _Tp>
// struct ______ref_return2<_Tp, false, class _A0, class _A1> // pointer to member data
// {
// static_assert(sizeof(_Tp) == 0, "An attempt has been made to `call` a pointer"
// " to member data with too many arguments.");
// };
//
//
// template <class _Tp, class _A0, class _A1>
// struct ____ref_return2<_Tp, false, _A0, _A1>
// : public ______ref_return2<typename remove_cv<_Tp>::type,
// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value, _A0, _A1>
// {
// };
//
//
// template <class _Tp, class _A0, class _A1>
// struct __ref_return2
// : public ____ref_return2<typename remove_reference<_Tp>::type,
// is_class<typename remove_reference<_Tp>::type>::value, _A0, _A1>
// {
// };
//
//
// __ref_return3
//
//
// template <class _Tp, bool _IsClass, class _A0, class _A1, class _A2>
// struct ____ref_return3 // _IsClass is true
// {
// typedef typename result_of<_Tp(_A0, _A1, _A2)>::type type;
// };
//
//
// template <class _Tp, bool _HasResultType, class _A0, class _A1, class _A2>
// struct ______ref_return3 // _HasResultType is true
// {
// typedef typename __callable_type<_Tp>::result_type type;
// };
//
//
// template <class _Tp>
// struct ______ref_return3<_Tp, false, class _A0, class _A1, class _A2> // pointer to member data
// {
// static_assert(sizeof(_Tp) == 0, "An attempt has been made to `call` a pointer"
// " to member data with too many arguments.");
// };
//
//
// template <class _Tp, class _A0, class _A1, class _A2>
// struct ____ref_return3<_Tp, false, _A0, _A1, _A2>
// : public ______ref_return3<typename remove_cv<_Tp>::type,
// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value, _A0, _A1, _A2>
// {
// };
//
//
// template <class _Tp, class _A0, class _A1, class _A2>
// struct __ref_return3
// : public ____ref_return3<typename remove_reference<_Tp>::type,
@@ -411,6 +411,7 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile>
// {
// };
// first bullet
template <class _R, class _T, class _T1>
@@ -873,7 +874,7 @@ __invoke(_R _T::* __f, _T1& __t1)
template <class _F>
inline _LIBCPP_INLINE_VISIBILITY
decltype(declval<_F>()())
typename result_of<_F()>::type
__invoke(_F __f)
{
return __f();
@@ -881,7 +882,7 @@ __invoke(_F __f)
template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
decltype(declval<_F>()(declval<_A0&>()))
typename result_of<_F(_A0)>::type
__invoke(_F __f, _A0& __a0)
{
return __f(__a0);
@@ -889,7 +890,7 @@ __invoke(_F __f, _A0& __a0)
template <class _F, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>()))
typename result_of<_F(_A0, _A1)>::type
__invoke(_F __f, _A0& __a0, _A1& __a1)
{
return __f(__a0, __a1);
@@ -897,7 +898,7 @@ __invoke(_F __f, _A0& __a0, _A1& __a1)
template <class _F, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
typename result_of<_F(_A0, _A1, _A2)>::type
__invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
{
return __f(__a0, __a1, __a2);
@@ -910,7 +911,7 @@ __invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
// {
// return __f();
// }
//
//
// template <class _R, class _F, class _A0>
// inline _LIBCPP_INLINE_VISIBILITY
// typename enable_if
@@ -922,7 +923,7 @@ __invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
// {
// return __f(__a0);
// }
//
//
// template <class _R, class _F, class _A0, class _A1>
// inline _LIBCPP_INLINE_VISIBILITY
// _R
@@ -930,7 +931,7 @@ __invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
// {
// return __f(__a0, __a1);
// }
//
//
// template <class _R, class _F, class _A0, class _A1, class _A2>
// inline _LIBCPP_INLINE_VISIBILITY
// _R
@@ -996,7 +997,7 @@ struct __invoke_return2
};
template <class _Tp>
class _LIBCPP_VISIBLE reference_wrapper
class reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@@ -1015,7 +1016,6 @@ public:
// invoke
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type&>::type
operator() () const
{
@@ -1023,7 +1023,6 @@ public:
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type&, _A0>::type
operator() (_A0& __a0) const
{
@@ -1031,7 +1030,6 @@ public:
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type&, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const
{
@@ -1039,7 +1037,6 @@ public:
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type&, _A0, _A1, _A2>::type
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
{
@@ -1084,4 +1081,4 @@ cref(reference_wrapper<_Tp> __t)
return cref(__t.get());
}
#endif // _LIBCPP_FUNCTIONAL_BASE_03
#endif

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -22,18 +22,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_VISIBLE
size_t __next_prime(size_t);
template <class _NodePtr>
struct __hash_node_base
{
typedef __hash_node_base __first_node;
// typedef _NodePtr pointer;
typedef _NodePtr pointer;
_NodePtr __next_;
pointer __next_;
_LIBCPP_INLINE_VISIBILITY __hash_node_base() : __next_(nullptr) {}
__hash_node_base() : __next_(nullptr) {}
};
template <class _Tp, class _VoidPtr>
@@ -58,10 +57,10 @@ template <class, class, class, class> class __hash_table;
template <class> class __hash_const_iterator;
template <class> class __hash_map_iterator;
template <class> class __hash_map_const_iterator;
template <class, class, class, class, class> class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> class unordered_map;
template <class _NodePtr>
class _LIBCPP_VISIBLE __hash_iterator
class __hash_iterator
{
typedef _NodePtr __node_pointer;
@@ -80,21 +79,17 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_iterator() {}
__hash_iterator() {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return _STD::addressof(__node_->__value_);}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__hash_iterator& operator++()
{
__node_ = __node_->__next_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_iterator operator++(int)
{
__hash_iterator __t(*this);
@@ -102,28 +97,25 @@ public:
return __t;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_iterator& __x, const __hash_iterator& __y)
friend bool operator==(const __hash_iterator& __x, const __hash_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y)
friend bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_iterator(__node_pointer __node)
: __node_(__node)
{}
template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_map_iterator;
template <class, class, class, class, class> friend class unordered_map;
template <class, class, class, class, class> friend class unordered_multimap;
};
template <class _ConstNodePtr>
class _LIBCPP_VISIBLE __hash_const_iterator
class __hash_const_iterator
{
typedef _ConstNodePtr __node_pointer;
@@ -154,25 +146,20 @@ public:
__non_const_node_pointer;
typedef __hash_iterator<__non_const_node_pointer> __non_const_iterator;
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator() {}
__hash_const_iterator(const __non_const_iterator& __x)
: __node_(__x.__node_)
{}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return _STD::addressof(__node_->__value_);}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator& operator++()
{
__node_ = __node_->__next_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator operator++(int)
{
__hash_const_iterator __t(*this);
@@ -180,29 +167,26 @@ public:
return __t;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
friend bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
friend bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator(__node_pointer __node)
: __node_(__node)
{}
template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
template <class> friend class __hash_map_const_iterator;
template <class, class, class, class, class> friend class unordered_map;
template <class, class, class, class, class> friend class unordered_multimap;
};
template <class> class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> class __hash_const_local_iterator;
template <class _NodePtr>
class _LIBCPP_VISIBLE __hash_local_iterator
class __hash_local_iterator
{
typedef _NodePtr __node_pointer;
@@ -224,14 +208,11 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() {}
__hash_local_iterator() {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &__node_->__value_;}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return &__node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator& operator++()
{
__node_ = __node_->__next_;
@@ -240,7 +221,6 @@ public:
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator operator++(int)
{
__hash_local_iterator __t(*this);
@@ -248,15 +228,12 @@ public:
return __t;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
friend bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
friend bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator(__node_pointer __node, size_t __bucket,
size_t __bucket_count)
: __node_(__node),
@@ -268,12 +245,12 @@ private:
}
template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_iterator;
template <class> friend class __hash_const_local_iterator;
template <class> friend class __hash_map_iterator;
};
template <class _ConstNodePtr>
class _LIBCPP_VISIBLE __hash_const_local_iterator
class __hash_const_local_iterator
{
typedef _ConstNodePtr __node_pointer;
@@ -308,20 +285,16 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator() {}
__hash_const_local_iterator(const __non_const_iterator& __x)
: __node_(__x.__node_),
__bucket_(__x.__bucket_),
__bucket_count_(__x.__bucket_count_)
{}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &__node_->__value_;}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return &__node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator& operator++()
{
__node_ = __node_->__next_;
@@ -330,7 +303,6 @@ public:
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator operator++(int)
{
__hash_const_local_iterator __t(*this);
@@ -338,15 +310,12 @@ public:
return __t;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
friend bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
friend bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator(__node_pointer __node, size_t __bucket,
size_t __bucket_count)
: __node_(__node),
@@ -358,7 +327,7 @@ private:
}
template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
template <class> friend class __hash_map_const_iterator;
};
template <class _Alloc>
@@ -372,32 +341,27 @@ class __bucket_list_deallocator
public:
typedef typename __alloc_traits::pointer pointer;
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator()
: __data_(0) {}
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator(const allocator_type& __a, size_type __size)
: __data_(__size, __a) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
: __data_(_STD::move(__x.__data_))
{
__x.size() = 0;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY size_type& size() {return __data_.first();}
_LIBCPP_INLINE_VISIBILITY size_type size() const {return __data_.first();}
size_type& size() {return __data_.first();}
size_type size() const {return __data_.first();}
_LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __data_.second();}
_LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __data_.second();}
allocator_type& __alloc() {return __data_.second();}
const allocator_type& __alloc() const {return __data_.second();}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
__alloc_traits::deallocate(__alloc(), __p, size());
@@ -423,17 +387,15 @@ private:
public:
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_node_destructor(allocator_type& __na)
: __na_(__na),
__value_constructed(false)
{}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__value_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
__alloc_traits::destroy(__na_, addressof(__p->__value_));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -495,21 +457,21 @@ private:
__compressed_pair<float, key_equal> __p3_;
// --- Member data end ---
_LIBCPP_INLINE_VISIBILITY size_type& size() {return __p2_.first();}
size_type& size() {return __p2_.first();}
public:
_LIBCPP_INLINE_VISIBILITY size_type size() const {return __p2_.first();}
size_type size() const {return __p2_.first();}
_LIBCPP_INLINE_VISIBILITY hasher& hash_function() {return __p2_.second();}
_LIBCPP_INLINE_VISIBILITY const hasher& hash_function() const {return __p2_.second();}
hasher& hash_function() {return __p2_.second();}
const hasher& hash_function() const {return __p2_.second();}
_LIBCPP_INLINE_VISIBILITY float& max_load_factor() {return __p3_.first();}
_LIBCPP_INLINE_VISIBILITY float max_load_factor() const {return __p3_.first();}
float& max_load_factor() {return __p3_.first();}
float max_load_factor() const {return __p3_.first();}
_LIBCPP_INLINE_VISIBILITY key_equal& key_eq() {return __p3_.second();}
_LIBCPP_INLINE_VISIBILITY const key_equal& key_eq() const {return __p3_.second();}
key_equal& key_eq() {return __p3_.second();}
const key_equal& key_eq() const {return __p3_.second();}
_LIBCPP_INLINE_VISIBILITY __node_allocator& __node_alloc() {return __p1_.second();}
_LIBCPP_INLINE_VISIBILITY const __node_allocator& __node_alloc() const {return __p1_.second();}
__node_allocator& __node_alloc() {return __p1_.second();}
const __node_allocator& __node_alloc() const {return __p1_.second();}
public:
typedef __hash_iterator<__node_pointer> iterator;
@@ -524,14 +486,14 @@ public:
explicit __hash_table(const allocator_type& __a);
__hash_table(const __hash_table& __u);
__hash_table(const __hash_table& __u, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
__hash_table(__hash_table&& __u);
__hash_table(__hash_table&& __u, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
~__hash_table();
__hash_table& operator=(const __hash_table& __u);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
__hash_table& operator=(__hash_table&& __u);
#endif
template <class _InputIterator>
@@ -539,7 +501,6 @@ public:
template <class _InputIterator>
void __assign_multi(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const
{
return allocator_traits<__pointer_allocator>::max_size(
@@ -551,38 +512,36 @@ public:
iterator __node_insert_multi(const_iterator __p,
__node_pointer __nd);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#ifdef _LIBCPP_MOVE
template <class... _Args>
pair<iterator, bool> __emplace_unique(_Args&&... __args);
template <class... _Args>
iterator __emplace_multi(_Args&&... __args);
template <class... _Args>
iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#endif
pair<iterator, bool> __insert_unique(const value_type& __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _P>
pair<iterator, bool> __insert_unique(_P&& __x);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _P>
iterator __insert_multi(_P&& __x);
template <class _P>
iterator __insert_multi(const_iterator __p, _P&& __x);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
iterator __insert_multi(const value_type& __x);
iterator __insert_multi(const_iterator __p, const value_type& __x);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void clear();
void rehash(size_type __n);
_LIBCPP_INLINE_VISIBILITY void reserve(size_type __n)
void reserve(size_type __n)
{rehash(static_cast<size_type>(ceil(__n / max_load_factor())));}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const
{
return __bucket_list_.get_deleter().size();
@@ -594,7 +553,6 @@ public:
const_iterator end() const;
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const _Key& __k) const
{return hash_function()(__k) % bucket_count();}
@@ -635,65 +593,57 @@ public:
void swap(__hash_table& __u);
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const
{return __bucket_list_.get_deleter().__alloc().max_size();}
size_type bucket_size(size_type __n) const;
_LIBCPP_INLINE_VISIBILITY float load_factor() const
float load_factor() const
{
size_type __bc = bucket_count();
return __bc != 0 ? (float)size() / __bc : 0.f;
}
_LIBCPP_INLINE_VISIBILITY void max_load_factor(float __mlf)
void max_load_factor(float __mlf)
{max_load_factor() = _STD::max(__mlf, load_factor());}
_LIBCPP_INLINE_VISIBILITY local_iterator begin(size_type __n)
local_iterator begin(size_type __n)
{return local_iterator(__bucket_list_[__n], __n, bucket_count());}
_LIBCPP_INLINE_VISIBILITY local_iterator end(size_type __n)
local_iterator end(size_type __n)
{return local_iterator(nullptr, __n, bucket_count());}
_LIBCPP_INLINE_VISIBILITY const_local_iterator cbegin(size_type __n) const
const_local_iterator cbegin(size_type __n) const
{return const_local_iterator(__bucket_list_[__n], __n, bucket_count());}
_LIBCPP_INLINE_VISIBILITY const_local_iterator cend(size_type __n) const
const_local_iterator cend(size_type __n) const
{return const_local_iterator(nullptr, __n, bucket_count());}
private:
void __rehash(size_type __n);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class ..._Args>
__node_holder __construct_node(_Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
__node_holder __construct_node(value_type&& __v, size_t __hash);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
__node_holder __construct_node(const value_type& __v);
#endif
__node_holder __construct_node(const value_type& __v, size_t __hash);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __hash_table& __u)
{__copy_assign_alloc(__u, integral_constant<bool,
__node_traits::propagate_on_container_copy_assignment::value>());}
void __copy_assign_alloc(const __hash_table& __u, true_type);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __hash_table& __u, 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, true_type);
_LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__hash_table& __u)
void __move_assign_alloc(__hash_table& __u)
{__move_assign_alloc(__u, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__hash_table& __u, true_type)
{
__bucket_list_.get_deleter().__alloc() =
_STD::move(__u.__bucket_list_.get_deleter().__alloc());
__node_alloc() = _STD::move(__u.__node_alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__hash_table&, false_type) {}
void __move_assign_alloc(__hash_table&, false_type) {}
template <class _A>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y)
@@ -705,7 +655,6 @@ private:
}
template <class _A>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y, true_type)
@@ -715,7 +664,6 @@ private:
}
template <class _A>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y, false_type) {}
@@ -725,7 +673,7 @@ private:
};
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
: __p2_(0),
__p3_(1.0f)
@@ -733,7 +681,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
const key_equal& __eql)
: __bucket_list_(nullptr, __bucket_list_deleter()),
@@ -786,7 +734,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
{
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
@@ -798,7 +746,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
if (size() > 0)
{
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
static_cast<__node_pointer>(addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
@@ -822,14 +770,14 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
__p1_.first().__next_ = __u.__p1_.first().__next_;
__u.__p1_.first().__next_ = nullptr;
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
static_cast<__node_pointer>(addressof(__p1_.first()));
size() = __u.size();
__u.size() = 0;
}
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
@@ -875,7 +823,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate(__node_pointer __np)
while (__np != nullptr)
{
__node_pointer __next = __np->__next_;
__node_traits::destroy(__na, _STD::addressof(__np->__value_));
__node_traits::destroy(__na, addressof(__np->__value_));
__node_traits::deallocate(__na, __np, 1);
__np = __next;
}
@@ -894,7 +842,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach()
return __cache;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
@@ -914,7 +862,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
if (size() > 0)
{
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
static_cast<__node_pointer>(addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
@@ -938,7 +886,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
const_iterator __i = __u.begin();
while (__cache != nullptr && __u.size() != 0)
{
@@ -954,7 +902,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
__deallocate(__cache);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__deallocate(__cache);
}
const_iterator __i = __u.begin();
@@ -969,7 +917,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>&
__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
{
@@ -978,7 +926,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _InputIterator>
@@ -992,7 +940,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (; __cache != nullptr && __first != __last; ++__first)
{
__cache->__value_ = *__first;
@@ -1007,7 +955,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first
__deallocate(__cache);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__deallocate(__cache);
}
for (; __first != __last; ++__first)
@@ -1026,7 +974,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (; __cache != nullptr && __first != __last; ++__first)
{
__cache->__value_ = *__first;
@@ -1041,7 +989,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
__deallocate(__cache);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__deallocate(__cache);
}
for (; __first != __last; ++__first)
@@ -1049,7 +997,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin()
{
@@ -1057,7 +1005,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end()
{
@@ -1065,7 +1013,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::end()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const
{
@@ -1073,7 +1021,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const
{
@@ -1131,7 +1079,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
__nd->__next_ = __pn->__next_;
__pn->__next_ = __nd;
// fix up __bucket_list_
@@ -1169,7 +1117,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
__cp->__next_ = __pn->__next_;
__pn->__next_ = __cp;
// fix up __bucket_list_
@@ -1182,7 +1130,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
for (bool __found = false; __pn->__next_ != nullptr &&
__pn->__next_->__hash_ % __bc == __chash;
__pn = __pn->__next_)
{
{
// __found key_eq() action
// false false loop
// true true loop
@@ -1275,7 +1223,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
__h->__next_ = __pn->__next_;
__pn->__next_ = __h.get();
// fix up __bucket_list_
@@ -1297,8 +1245,7 @@ __done:
return pair<iterator, bool>(iterator(__nd), __inserted);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class... _Args>
@@ -1335,8 +1282,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
return __r;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _P>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
@@ -1349,9 +1294,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x)
return __r;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _P>
@@ -1376,7 +1321,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
return __r;
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
@@ -1399,7 +1344,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
return __r;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
@@ -1433,7 +1378,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
{
for (size_type __i = 0; __i < __nbc; ++__i)
__bucket_list_[__i] = nullptr;
__node_pointer __pp(static_cast<__node_pointer>(_STD::addressof(__p1_.first())));
__node_pointer __pp(static_cast<__node_pointer>(addressof(__p1_.first())));
__node_pointer __cp = __pp->__next_;
if (__cp != nullptr)
{
@@ -1464,7 +1409,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
__pp->__next_ = __np->__next_;
__np->__next_ = __bucket_list_[__chash]->__next_;
__bucket_list_[__chash]->__next_ = __cp;
}
}
}
@@ -1518,13 +1463,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
return const_iterator(__nd);
}
}
}
return end();
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class ..._Args>
@@ -1533,15 +1477,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
return __h;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v,
@@ -1549,14 +1491,14 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v,
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::move(__v));
__node_traits::construct(__na, addressof(__h->__value_), _STD::move(__v));
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
return _STD::move(__h);
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
@@ -1564,14 +1506,14 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__na, addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
return _STD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Hash, class _Equal, class _Alloc>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
@@ -1580,7 +1522,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__na, addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
@@ -1658,7 +1600,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p)
// Fix up __bucket_list_
// 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 (__pn == _STD::addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
if (__pn == addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
{
if (__cn->__next_ == nullptr || __cn->__next_->__hash_ % __bc != __chash)
__bucket_list_[__chash] = nullptr;
@@ -1679,7 +1621,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p)
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const
{
@@ -1791,10 +1733,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
__p3_.swap(__u.__p3_);
if (size() > 0)
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
static_cast<__node_pointer>(addressof(__p1_.first()));
if (__u.size() > 0)
__u.__bucket_list_[__u.__p1_.first().__next_->__hash_ % __u.bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__u.__p1_.first()));
static_cast<__node_pointer>(addressof(__u.__p1_.first()));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -30,7 +30,7 @@ class locale;
template <class _Facet> bool has_facet(const locale&) throw();
template <class _Facet> const _Facet& use_facet(const locale&);
class _LIBCPP_VISIBLE locale
class locale
{
public:
// types:
@@ -55,8 +55,7 @@ public:
explicit locale(const string&);
locale(const locale&, const char*, category);
locale(const locale&, const string&, category);
template <class _Facet>
_LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
template <class _Facet> locale(const locale&, _Facet*);
locale(const locale&, const locale&, category);
~locale() throw();
@@ -90,11 +89,10 @@ private:
template <class _Facet> friend const _Facet& use_facet(const locale&);
};
class _LIBCPP_VISIBLE locale::facet
class locale::facet
: public __shared_count
{
protected:
_LIBCPP_INLINE_VISIBILITY
explicit facet(size_t __refs = 0)
: __shared_count(static_cast<long>(__refs)-1) {}
@@ -106,14 +104,14 @@ private:
virtual void __on_zero_shared();
};
class _LIBCPP_VISIBLE locale::id
class locale::id
{
once_flag __flag_;
int32_t __id_;
static int32_t __next_id;
public:
_LIBCPP_INLINE_VISIBILITY id() {}
id() {}
private:
void __init();
void operator=(const id&); // = delete;
@@ -136,10 +134,8 @@ template <class _Facet>
locale
locale::combine(const locale& __other) const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!_STD::has_facet<_Facet>(__other))
throw runtime_error("locale::combine: locale missing facet");
#endif // _LIBCPP_NO_EXCEPTIONS
return locale(*this, &const_cast<_Facet&>(_STD::use_facet<_Facet>(__other)));
}
@@ -162,31 +158,27 @@ use_facet(const locale& __l)
// template <class _CharT> class collate;
template <class _CharT>
class _LIBCPP_VISIBLE collate
class collate
: public locale::facet
{
public:
typedef _CharT char_type;
typedef basic_string<char_type> string_type;
_LIBCPP_INLINE_VISIBILITY
explicit collate(size_t __refs = 0)
: locale::facet(__refs) {}
_LIBCPP_INLINE_VISIBILITY
int compare(const char_type* __lo1, const char_type* __hi1,
const char_type* __lo2, const char_type* __hi2) const
{
return do_compare(__lo1, __hi1, __lo2, __hi2);
}
_LIBCPP_INLINE_VISIBILITY
string_type transform(const char_type* __lo, const char_type* __hi) const
{
return do_transform(__lo, __hi);
}
_LIBCPP_INLINE_VISIBILITY
long hash(const char_type* __lo, const char_type* __hi) const
{
return do_hash(__lo, __hi);
@@ -241,15 +233,15 @@ collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
return static_cast<long>(h);
}
extern template class _LIBCPP_VISIBLE collate<char>;
extern template class _LIBCPP_VISIBLE collate<wchar_t>;
extern template class collate<char>;
extern template class collate<wchar_t>;
// template <class CharT> class collate_byname;
template <class _CharT> class _LIBCPP_VISIBLE collate_byname;
template <class _CharT> class collate_byname;
template <>
class _LIBCPP_VISIBLE collate_byname<char>
class collate_byname<char>
: public collate<char>
{
locale_t __l;
@@ -268,7 +260,7 @@ protected:
};
template <>
class _LIBCPP_VISIBLE collate_byname<wchar_t>
class collate_byname<wchar_t>
: public collate<wchar_t>
{
locale_t __l;
@@ -299,8 +291,7 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
// template <class charT> class ctype
class _LIBCPP_VISIBLE ctype_base
{
class ctype_base {
public:
typedef __uint32_t mask;
@@ -315,7 +306,7 @@ public:
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B;
#else // __APPLE__
#else /* !__APPLE__ */
static const mask space = _ISspace;
static const mask print = _ISprint;
static const mask cntrl = _IScntrl;
@@ -326,23 +317,23 @@ public:
static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit;
static const mask blank = _ISblank;
#endif // __APPLE__
#endif /* __APPLE__ */
static const mask alnum = alpha | digit;
static const mask graph = alnum | punct;
_LIBCPP_ALWAYS_INLINE ctype_base() {}
};
template <class _CharT> class _LIBCPP_VISIBLE ctype;
template <class _CharT> class ctype;
template <>
class _LIBCPP_VISIBLE ctype<wchar_t>
class ctype<wchar_t>
: public locale::facet,
public ctype_base
{
public:
typedef wchar_t char_type;
_LIBCPP_ALWAYS_INLINE
explicit ctype(size_t __refs = 0)
: locale::facet(__refs) {}
@@ -438,7 +429,7 @@ protected:
};
template <>
class _LIBCPP_VISIBLE ctype<char>
class ctype<char>
: public locale::facet, public ctype_base
{
const mask* __tab_;
@@ -535,7 +526,7 @@ public:
#else
static const size_t table_size = 256; // FIXME: Don't hardcode this.
#endif
_LIBCPP_ALWAYS_INLINE const mask* table() const throw() {return __tab_;}
const mask* table() const throw() {return __tab_;}
static const mask* classic_table() throw();
protected:
@@ -552,10 +543,10 @@ protected:
// template <class CharT> class ctype_byname;
template <class _CharT> class _LIBCPP_VISIBLE ctype_byname;
template <class _CharT> class ctype_byname;
template <>
class _LIBCPP_VISIBLE ctype_byname<char>
class ctype_byname<char>
: public ctype<char>
{
locale_t __l;
@@ -573,7 +564,7 @@ protected:
};
template <>
class _LIBCPP_VISIBLE ctype_byname<wchar_t>
class ctype_byname<wchar_t>
: public ctype<wchar_t>
{
locale_t __l;
@@ -704,7 +695,7 @@ tolower(_CharT __c, const locale& __loc)
// codecvt_base
class _LIBCPP_VISIBLE codecvt_base
class codecvt_base
{
public:
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
@@ -713,12 +704,12 @@ public:
// template <class internT, class externT, class stateT> class codecvt;
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_VISIBLE codecvt;
template <class _InternT, class _ExternT, class _StateT> class codecvt;
// template <> class codecvt<char, char, mbstate_t>
template <>
class _LIBCPP_VISIBLE codecvt<char, char, mbstate_t>
class codecvt<char, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -804,7 +795,7 @@ protected:
// template <> class codecvt<wchar_t, char, mbstate_t>
template <>
class _LIBCPP_VISIBLE codecvt<wchar_t, char, mbstate_t>
class codecvt<wchar_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -887,7 +878,7 @@ protected:
// template <> class codecvt<char16_t, char, mbstate_t>
template <>
class _LIBCPP_VISIBLE codecvt<char16_t, char, mbstate_t>
class codecvt<char16_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -973,7 +964,7 @@ protected:
// template <> class codecvt<char32_t, char, mbstate_t>
template <>
class _LIBCPP_VISIBLE codecvt<char32_t, char, mbstate_t>
class codecvt<char32_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -1059,14 +1050,12 @@ protected:
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
template <class _InternT, class _ExternT, class _StateT>
class _LIBCPP_VISIBLE codecvt_byname
class codecvt_byname
: public codecvt<_InternT, _ExternT, _StateT>
{
public:
_LIBCPP_ALWAYS_INLINE
explicit codecvt_byname(const char* __nm, size_t __refs = 0)
: codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
_LIBCPP_ALWAYS_INLINE
explicit codecvt_byname(const string& __nm, size_t __refs = 0)
: codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
protected:
@@ -1083,7 +1072,7 @@ extern template class codecvt_byname<wchar_t, char, mbstate_t>;
extern template class codecvt_byname<char16_t, char, mbstate_t>;
extern template class codecvt_byname<char32_t, char, mbstate_t>;
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
void __throw_runtime_error(const char*);
template <size_t _N>
struct __narrow_to_utf8
@@ -1267,10 +1256,10 @@ struct __widen_from_utf8<32>
// template <class charT> class numpunct
template <class _CharT> class _LIBCPP_VISIBLE numpunct;
template <class _CharT> class numpunct;
template <>
class _LIBCPP_VISIBLE numpunct<char>
class numpunct<char>
: public locale::facet
{
public:
@@ -1301,7 +1290,7 @@ protected:
};
template <>
class _LIBCPP_VISIBLE numpunct<wchar_t>
class numpunct<wchar_t>
: public locale::facet
{
public:
@@ -1333,10 +1322,10 @@ protected:
// template <class charT> class numpunct_byname
template <class charT> class _LIBCPP_VISIBLE numpunct_byname;
template <class charT> class numpunct_byname;
template <>
class _LIBCPP_VISIBLE numpunct_byname<char>
class numpunct_byname<char>
: public numpunct<char>
{
public:
@@ -1354,7 +1343,7 @@ private:
};
template <>
class _LIBCPP_VISIBLE numpunct_byname<wchar_t>
class numpunct_byname<wchar_t>
: public numpunct<wchar_t>
{
public:

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -18,24 +18,13 @@
#pragma GCC system_header
#ifdef _LIBCPP_SHARED_LOCK
namespace ting {
template <class> class shared_lock;
template <class> class upgrade_lock;
}
#endif // _LIBCPP_SHARED_LOCK
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_VISIBLE mutex
class mutex
{
pthread_mutex_t __m_;
public:
_LIBCPP_INLINE_VISIBILITY
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
~mutex();
@@ -49,12 +38,12 @@ public:
void unlock();
typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
native_handle_type native_handle() {return &__m_;}
};
struct _LIBCPP_VISIBLE defer_lock_t {};
struct _LIBCPP_VISIBLE try_to_lock_t {};
struct _LIBCPP_VISIBLE adopt_lock_t {};
struct defer_lock_t {};
struct try_to_lock_t {};
struct adopt_lock_t {};
//constexpr
extern const
@@ -69,7 +58,7 @@ extern const
adopt_lock_t adopt_lock;
template <class _Mutex>
class _LIBCPP_VISIBLE lock_guard
class lock_guard
{
public:
typedef _Mutex mutex_type;
@@ -78,13 +67,10 @@ private:
mutex_type& __m_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit lock_guard(mutex_type& __m)
: __m_(__m) {__m_.lock();}
_LIBCPP_INLINE_VISIBILITY
lock_guard(mutex_type& __m, adopt_lock_t)
: __m_(__m) {}
_LIBCPP_INLINE_VISIBILITY
~lock_guard() {__m_.unlock();}
private:
@@ -93,7 +79,7 @@ private:
};
template <class _Mutex>
class _LIBCPP_VISIBLE unique_lock
class unique_lock
{
public:
typedef _Mutex mutex_type;
@@ -103,29 +89,21 @@ private:
bool __owns_;
public:
_LIBCPP_INLINE_VISIBILITY
unique_lock() : __m_(nullptr), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY
explicit unique_lock(mutex_type& __m)
: __m_(&__m), __owns_(true) {__m_->lock();}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, defer_lock_t)
: __m_(&__m), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, try_to_lock_t)
: __m_(&__m), __owns_(__m.try_lock()) {}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, adopt_lock_t)
: __m_(&__m), __owns_(true) {}
template <class _Clock, class _Duration>
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
: __m_(&__m), __owns_(__m.try_lock_until(__t)) {}
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
: __m_(&__m), __owns_(__m.try_lock_for(__d)) {}
_LIBCPP_INLINE_VISIBILITY
~unique_lock()
{
if (__owns_)
@@ -137,12 +115,10 @@ private:
unique_lock& operator=(unique_lock const&); // = delete;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
unique_lock(unique_lock&& __u)
: __m_(__u.__m_), __owns_(__u.__owns_)
{__u.__m_ = nullptr; __u.__owns_ = false;}
_LIBCPP_INLINE_VISIBILITY
unique_lock& operator=(unique_lock&& __u)
{
if (__owns_)
@@ -153,29 +129,7 @@ public:
__u.__owns_ = false;
return *this;
}
#ifdef _LIBCPP_SHARED_LOCK
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
template <class _Clock, class _Duration>
unique_lock(ting::shared_lock<mutex_type>&&,
const chrono::time_point<_Clock, _Duration>&);
template <class _Rep, class _Period>
unique_lock(ting::shared_lock<mutex_type>&&,
const chrono::duration<_Rep, _Period>&);
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
template <class _Clock, class _Duration>
unique_lock(ting::upgrade_lock<mutex_type>&&,
const chrono::time_point<_Clock, _Duration>&);
template <class _Rep, class _Period>
unique_lock(ting::upgrade_lock<mutex_type>&&,
const chrono::duration<_Rep, _Period>&);
#endif // _LIBCPP_SHARED_LOCK
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void lock();
bool try_lock();
@@ -187,13 +141,11 @@ public:
void unlock();
_LIBCPP_INLINE_VISIBILITY
void swap(unique_lock& __u)
{
_STD::swap(__m_, __u.__m_);
_STD::swap(__owns_, __u.__owns_);
}
_LIBCPP_INLINE_VISIBILITY
mutex_type* release()
{
mutex_type* __m = __m_;
@@ -202,12 +154,9 @@ public:
return __m;
}
_LIBCPP_INLINE_VISIBILITY
bool owns_lock() const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
// explicit
operator bool () const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
mutex_type* mutex() const {return __m_;}
};
@@ -272,11 +221,11 @@ unique_lock<_Mutex>::unlock()
}
template <class _Mutex>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
struct _LIBCPP_VISIBLE cv_status
struct cv_status
{
enum _ {
no_timeout,
@@ -285,16 +234,15 @@ struct _LIBCPP_VISIBLE cv_status
_ __v_;
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
cv_status(_ __v) : __v_(__v) {}
operator int() const {return __v_;}
};
class _LIBCPP_VISIBLE condition_variable
class condition_variable
{
pthread_cond_t __cv_;
public:
_LIBCPP_INLINE_VISIBILITY
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
~condition_variable();
@@ -338,7 +286,7 @@ public:
_Predicate __pred);
typedef pthread_cond_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
native_handle_type native_handle() {return &__cv_;}
private:
void __do_timed_wait(unique_lock<mutex>& __lk,
@@ -346,7 +294,7 @@ private:
};
template <class _To, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
chrono::__is_duration<_To>::value,
@@ -414,21 +362,21 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d)
{
using namespace chrono;
system_clock::time_point __s_now = system_clock::now();
steady_clock::time_point __c_now = steady_clock::now();
system_clock::time_point __s_now = system_clock::now();
monotonic_clock::time_point __c_now = monotonic_clock::now();
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout;
return monotonic_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout;
}
template <class _Rep, class _Period, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred)
{
return wait_until(__lk, chrono::steady_clock::now() + __d,
return wait_until(__lk, chrono::monotonic_clock::now() + __d,
_STD::move(__pred));
}

View File

@@ -18,7 +18,7 @@ protected:
void __throw_out_of_range() const;
};
template <class _Tp, class _Allocator = allocator<_Tp> >
template <class _Tp, class _Allocator>
struct __split_buffer
: private __split_buffer_common<true>
{
@@ -26,7 +26,7 @@ private:
__split_buffer(const __split_buffer&);
__split_buffer& operator=(const __split_buffer&);
public:
typedef _Tp value_type;
typedef _Tp value_type;
typedef _Allocator allocator_type;
typedef typename remove_reference<allocator_type>::type __alloc_rr;
typedef allocator_traits<__alloc_rr> __alloc_traits;
@@ -58,11 +58,11 @@ public:
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
~__split_buffer();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
__split_buffer(__split_buffer&& __c);
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
__split_buffer& operator=(__split_buffer&& __c);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY iterator begin() {return __begin_;}
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return __begin_;}
@@ -85,20 +85,22 @@ public:
void shrink_to_fit();
void push_front(const_reference __x);
void push_back(const_reference __x);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#ifdef _LIBCPP_MOVE
void push_front(value_type&& __x);
void push_back(value_type&& __x);
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
void emplace_back(_Args&&... __args);
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#endif
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
void __construct_at_end(size_type __n);
void __construct_at_end(size_type __n, false_type);
void __construct_at_end(size_type __n, true_type);
void __construct_at_end(size_type __n, const_reference __x);
void __construct_at_end(size_type __n, const_reference __x, false_type);
void __construct_at_end(size_type __n, const_reference __x, true_type);
template <class _InputIter>
typename enable_if
<
@@ -116,12 +118,12 @@ public:
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
{__destruct_at_begin(__new_begin, has_trivial_destructor<value_type>());}
void __destruct_at_begin(pointer __new_begin, false_type);
void __destruct_at_begin(pointer __new_begin, true_type);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last)
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
{__destruct_at_end(__new_last, has_trivial_destructor<value_type>());}
void __destruct_at_end(pointer __new_last, false_type);
void __destruct_at_end(pointer __new_last, true_type);
@@ -130,29 +132,23 @@ public:
bool __invariants() const;
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __split_buffer& __c, true_type)
{
__alloc() = _STD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __split_buffer& __c, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type)
{}
};
@@ -188,8 +184,16 @@ __split_buffer<_Tp, _Allocator>::__invariants() const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
{
__construct_at_end(__n, __is_zero_default_constructible<value_type>());
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
{
__alloc_rr& __a = this->__alloc();
do
@@ -200,6 +204,15 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
{
_STD::memset(this->__end_, 0, __n*sizeof(value_type));
this->__end_ += __n;
}
// Copy constructs __n objects starting at __end_ from __x
// throws if construction throws
// Precondition: __n > 0
@@ -207,8 +220,17 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
__construct_at_end(__n, __x, integral_constant<bool, has_trivial_copy_constructor<value_type>::value &&
has_trivial_copy_assign<value_type>::value>());
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
{
__alloc_rr& __a = this->__alloc();
do
@@ -219,6 +241,15 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_referen
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
{
_STD::fill_n(this->__end_, __n, __x);
this->__end_ += __n;
}
template <class _Tp, class _Allocator>
template <class _InputIter>
typename enable_if
@@ -336,7 +367,7 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
__alloc_traits::deallocate(__alloc(), __first_, capacity());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
@@ -394,7 +425,7 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Allocator>
void
@@ -432,7 +463,7 @@ __split_buffer<_Tp, _Allocator>::shrink_to_fit()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -446,7 +477,7 @@ __split_buffer<_Tp, _Allocator>::shrink_to_fit()
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
}
}
@@ -466,7 +497,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
else
{
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 + 2) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_);
@@ -479,7 +510,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
--__begin_;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Allocator>
void
@@ -497,7 +528,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
else
{
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 + 2) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_);
@@ -511,7 +542,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
--__begin_;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
@@ -543,7 +574,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
++__end_;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Allocator>
void
@@ -575,8 +606,6 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
++__end_;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Allocator>
template <class... _Args>
void
@@ -608,9 +637,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
++__end_;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -64,9 +64,7 @@ public:
}
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
_LIBCPP_INLINE_VISIBILITY
bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;}
_LIBCPP_INLINE_VISIBILITY
bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;}
};

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -97,7 +97,7 @@ typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::__getchar(bool __consume)
{
char __extbuf[__limit];
int __nread = _STD::max(1, __encoding_);
int __nread = max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i)
{
char __c = getc(__file_);

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -22,12 +22,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class, class, class> class __tree;
template <class, class, class> class _LIBCPP_VISIBLE __tree_iterator;
template <class, class, class> class _LIBCPP_VISIBLE __tree_const_iterator;
template <class, class, class, class> class _LIBCPP_VISIBLE map;
template <class, class, class, class> class _LIBCPP_VISIBLE multimap;
template <class, class, class> class _LIBCPP_VISIBLE set;
template <class, class, class> class _LIBCPP_VISIBLE multiset;
template <class, class, class> class __tree_iterator;
template <class, class, class> class __tree_const_iterator;
template <class, class, class, class> class map;
template <class, class, class, class> class multimap;
template <class, class, class> class set;
template <class, class, class> class multiset;
/*
@@ -53,7 +53,7 @@ __root, have a non-null __parent_ field.
// Returns: true if __x is a left child of its parent, else false
// Precondition: __x != nullptr.
template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
__tree_is_left_child(_NodePtr __x)
{
@@ -119,7 +119,7 @@ __tree_invariant(_NodePtr __root)
// Returns: pointer to the left-most node under __x.
// Precondition: __x != nullptr.
template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY
inline
_NodePtr
__tree_min(_NodePtr __x)
{
@@ -131,7 +131,7 @@ __tree_min(_NodePtr __x)
// Returns: pointer to the right-most node under __x.
// Precondition: __x != nullptr.
template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY
inline
_NodePtr
__tree_max(_NodePtr __x)
{
@@ -343,7 +343,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z)
// but copy __z's color. This does not impact __x or __w.
if (__y != __z)
{
// __z->__left_ != nulptr but __z->__right_ might == __x == nullptr
// __z->__left_ != nulptr but __z->__right_ might == __x == nullptr
__y->__parent_ = __z->__parent_;
if (__tree_is_left_child(__z))
__y->__parent_->__left_ = __y;
@@ -413,8 +413,8 @@ __tree_remove(_NodePtr __root, _NodePtr __z)
}
// reset sibling, and it still can't be null
__w = __tree_is_left_child(__x) ?
__x->__parent_->__right_ :
__x->__parent_->__left_;
__x->__parent_->__right_ :
__x->__parent_->__left_;
// continue;
}
else // __w has a red child
@@ -465,8 +465,8 @@ __tree_remove(_NodePtr __root, _NodePtr __z)
}
// reset sibling, and it still can't be null
__w = __tree_is_left_child(__x) ?
__x->__parent_->__right_ :
__x->__parent_->__left_;
__x->__parent_->__right_ :
__x->__parent_->__left_;
// continue;
}
else // __w has a red child
@@ -496,6 +496,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z)
template <class> class __map_node_destructor;
template <class _Allocator>
class __tree_node_destructor
{
@@ -513,17 +514,15 @@ private:
public:
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __tree_node_destructor(allocator_type& __na)
: __na_(__na),
__value_constructed(false)
{}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__value_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
__alloc_traits::destroy(__na_, addressof(__p->__value_));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -540,7 +539,6 @@ public:
typedef _Pointer pointer;
pointer __left_;
_LIBCPP_INLINE_VISIBILITY
__tree_end_node() : __left_() {}
};
@@ -579,7 +577,6 @@ public:
pointer __parent_;
bool __is_black_;
_LIBCPP_INLINE_VISIBILITY
__tree_node_base() : __right_(), __parent_(), __is_black_(false) {}
};
@@ -593,23 +590,21 @@ public:
value_type __value_;
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#ifdef _LIBCPP_MOVE
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
explicit __tree_node(_Args&& ...__args)
: __value_(_STD::forward<_Args>(__args)...) {}
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
#else
explicit __tree_node(const value_type& __v)
: __value_(__v) {}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#endif
};
template <class> class __map_iterator;
template <class> class __map_const_iterator;
template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_VISIBLE __tree_iterator
class __tree_iterator
{
typedef _NodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
@@ -632,48 +627,41 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __tree_iterator() {}
__tree_iterator() {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
reference operator*() const {return __ptr_->__value_;}
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator& operator++()
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
return *this;}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator operator++(int)
{__tree_iterator __t(*this); ++(*this); return __t;}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator& operator--()
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
return *this;}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator operator--(int)
{__tree_iterator __t(*this); --(*this); return __t;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __tree_iterator& __x, const __tree_iterator& __y)
friend bool operator==(const __tree_iterator& __x, const __tree_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y)
friend bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y)
{return !(__x == __y);}
private:
_LIBCPP_INLINE_VISIBILITY
explicit __tree_iterator(__node_pointer __p) : __ptr_(__p) {}
template <class, class, class> friend class __tree;
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __map_iterator;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_VISIBLE set;
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
template <class, class, class> friend class __tree_const_iterator;
template <class> friend class __map_iterator;
template <class, class, class, class> friend class map;
template <class, class, class, class> friend class multimap;
template <class, class, class> friend class set;
template <class, class, class> friend class multiset;
};
template <class _Tp, class _ConstNodePtr, class _DiffType>
class _LIBCPP_VISIBLE __tree_const_iterator
class __tree_const_iterator
{
typedef _ConstNodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
@@ -702,7 +690,7 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() {}
__tree_const_iterator() {}
private:
typedef typename remove_const<__node>::type __non_const_node;
typedef typename pointer_traits<__node_pointer>::template
@@ -715,44 +703,36 @@ private:
typedef __tree_iterator<value_type, __non_const_node_pointer, difference_type>
__non_const_iterator;
public:
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator(__non_const_iterator __p) : __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
reference operator*() const {return __ptr_->__value_;}
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator++()
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
return *this;}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator operator++(int)
{__tree_const_iterator __t(*this); ++(*this); return __t;}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator--()
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
return *this;}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator operator--(int)
{__tree_const_iterator __t(*this); --(*this); return __t;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
friend bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
friend bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
{return !(__x == __y);}
private:
_LIBCPP_INLINE_VISIBILITY
explicit __tree_const_iterator(__node_pointer __p) : __ptr_(__p) {}
template <class, class, class> friend class __tree;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_VISIBLE set;
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
template <class, class, class, class> friend class map;
template <class, class, class, class> friend class multimap;
template <class, class, class> friend class set;
template <class, class, class> friend class multiset;
template <class> friend class __map_const_iterator;
};
template <class _Tp, class _Compare, class _Allocator>
@@ -769,7 +749,6 @@ public:
typedef typename __alloc_traits::difference_type difference_type;
typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>
@@ -780,10 +759,10 @@ public:
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer;
typedef typename __node_base::pointer __node_base_pointer;
typedef typename __node_base::const_pointer __node_base_const_pointer;
typedef typename __node::base::pointer __node_base_pointer;
typedef typename __node::base::const_pointer __node_base_const_pointer;
private:
typedef typename __node_base::base __end_node_t;
typedef typename __node::base::base __end_node_t;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__end_node_t>
@@ -804,7 +783,6 @@ private:
__compressed_pair<size_type, value_compare> __pair3_;
public:
_LIBCPP_INLINE_VISIBILITY
__node_pointer __end_node()
{
return static_cast<__node_pointer>
@@ -812,7 +790,6 @@ public:
pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first())
);
}
_LIBCPP_INLINE_VISIBILITY
__node_const_pointer __end_node() const
{
return static_cast<__node_const_pointer>
@@ -820,33 +797,22 @@ public:
pointer_traits<__end_node_const_ptr>::pointer_to(__pair1_.first())
);
}
_LIBCPP_INLINE_VISIBILITY
__node_allocator& __node_alloc() {return __pair1_.second();}
private:
_LIBCPP_INLINE_VISIBILITY
const __node_allocator& __node_alloc() const {return __pair1_.second();}
_LIBCPP_INLINE_VISIBILITY
__node_pointer& __begin_node() {return __begin_node_;}
_LIBCPP_INLINE_VISIBILITY
const __node_pointer& __begin_node() const {return __begin_node_;}
public:
_LIBCPP_INLINE_VISIBILITY
allocator_type __alloc() const {return allocator_type(__node_alloc());}
private:
_LIBCPP_INLINE_VISIBILITY
size_type& size() {return __pair3_.first();}
public:
_LIBCPP_INLINE_VISIBILITY
const size_type& size() const {return __pair3_.first();}
_LIBCPP_INLINE_VISIBILITY
value_compare& value_comp() {return __pair3_.second();}
_LIBCPP_INLINE_VISIBILITY
const value_compare& value_comp() const {return __pair3_.second();}
public:
_LIBCPP_INLINE_VISIBILITY
__node_pointer __root()
{return static_cast<__node_pointer> (__end_node()->__left_);}
_LIBCPP_INLINE_VISIBILITY
__node_const_pointer __root() const
{return static_cast<__node_const_pointer>(__end_node()->__left_);}
@@ -862,32 +828,26 @@ public:
void __assign_unique(_InputIterator __first, _InputIterator __last);
template <class _InputIterator>
void __assign_multi(_InputIterator __first, _InputIterator __last);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
__tree(__tree&& __t);
__tree(__tree&& __t, const allocator_type& __a);
__tree& operator=(__tree&& __t);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
~__tree();
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return iterator(__begin_node());}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return const_iterator(__begin_node());}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return iterator(__end_node());}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return const_iterator(__end_node());}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __node_traits::max_size(__node_alloc());}
void clear();
void swap(__tree& __t);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class... _Args>
pair<iterator, bool>
__emplace_unique(_Args&&... __args);
@@ -901,7 +861,6 @@ public:
template <class... _Args>
iterator
__emplace_hint_multi(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _V>
pair<iterator, bool> __insert_unique(_V&& __v);
@@ -911,12 +870,13 @@ public:
iterator __insert_multi(_V&& __v);
template <class _V>
iterator __insert_multi(const_iterator __p, _V&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
pair<iterator, bool> __insert_unique(const value_type& __v);
iterator __insert_unique(const_iterator __p, const value_type& __v);
iterator __insert_multi(const value_type& __v);
iterator __insert_multi(const_iterator __p, const value_type& __v);
#endif
pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
iterator __node_insert_unique(const_iterator __p,
@@ -947,7 +907,6 @@ public:
size_type __count_multi(const _Key& __k) const;
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const _Key& __v)
{return __lower_bound(__v, __root(), __end_node());}
template <class _Key>
@@ -955,7 +914,6 @@ public:
__node_pointer __root,
__node_pointer __result);
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const _Key& __v) const
{return __lower_bound(__v, __root(), __end_node());}
template <class _Key>
@@ -963,7 +921,6 @@ public:
__node_const_pointer __root,
__node_const_pointer __result) const;
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const _Key& __v)
{return __upper_bound(__v, __root(), __end_node());}
template <class _Key>
@@ -971,7 +928,6 @@ public:
__node_pointer __root,
__node_pointer __result);
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const _Key& __v) const
{return __upper_bound(__v, __root(), __end_node());}
template <class _Key>
@@ -997,66 +953,57 @@ public:
__node_holder remove(const_iterator __p);
private:
typename __node_base::pointer&
__find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v);
typename __node_base::pointer&
__find_leaf_high(typename __node_base::pointer& __parent, const value_type& __v);
typename __node_base::pointer&
typename __node::base::pointer&
__find_leaf_low(typename __node::base::pointer& __parent, const value_type& __v);
typename __node::base::pointer&
__find_leaf_high(typename __node::base::pointer& __parent, const value_type& __v);
typename __node::base::pointer&
__find_leaf(const_iterator __hint,
typename __node_base::pointer& __parent, const value_type& __v);
typename __node::base::pointer& __parent, const value_type& __v);
template <class _Key>
typename __node_base::pointer&
__find_equal(typename __node_base::pointer& __parent, const _Key& __v);
typename __node::base::pointer&
__find_equal(typename __node::base::pointer& __parent, const _Key& __v);
template <class _Key>
typename __node_base::pointer&
__find_equal(const_iterator __hint, typename __node_base::pointer& __parent,
typename __node::base::pointer&
__find_equal(const_iterator __hint, typename __node::base::pointer& __parent,
const _Key& __v);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#ifdef _LIBCPP_MOVE
template <class ..._Args>
__node_holder __construct_node(_Args&& ...__args);
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#else
__node_holder __construct_node(const value_type& __v);
#endif
void destroy(__node_pointer __nd);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __tree& __t)
{__copy_assign_alloc(__t, integral_constant<bool,
__node_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __tree& __t, true_type)
{__node_alloc() = __t.__node_alloc();}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __tree& __t, false_type) {}
void __move_assign(__tree& __t, false_type);
void __move_assign(__tree& __t, true_type);
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t)
{__move_assign_alloc(__t, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t, true_type)
{__node_alloc() = _STD::move(__t.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t, false_type) {}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__node_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
{}
@@ -1155,10 +1102,8 @@ __tree<_Tp, _Compare, _Allocator>::__assign_unique(_InputIterator __first, _Inpu
if (size() != 0)
{
__node_pointer __cache = __detach();
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
for (; __cache != nullptr && __first != __last; ++__first)
{
__cache->__value_ = *__first;
@@ -1166,7 +1111,6 @@ __tree<_Tp, _Compare, _Allocator>::__assign_unique(_InputIterator __first, _Inpu
__node_insert_unique(__cache);
__cache = __next;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
@@ -1175,7 +1119,6 @@ __tree<_Tp, _Compare, _Allocator>::__assign_unique(_InputIterator __first, _Inpu
destroy(__cache);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
if (__cache != nullptr)
{
while (__cache->__parent_ != nullptr)
@@ -1195,10 +1138,8 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
if (size() != 0)
{
__node_pointer __cache = __detach();
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
for (; __cache != nullptr && __first != __last; ++__first)
{
__cache->__value_ = *__first;
@@ -1206,7 +1147,6 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
__node_insert_multi(__cache);
__cache = __next;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
@@ -1215,7 +1155,6 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
destroy(__cache);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
if (__cache != nullptr)
{
while (__cache->__parent_ != nullptr)
@@ -1236,7 +1175,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
__begin_node() = __end_node();
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
@@ -1314,10 +1253,8 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
if (size() != 0)
{
__node_pointer __cache = __detach();
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
while (__cache != nullptr && __t.size() != 0)
{
__cache->__value_ = _STD::move(__t.remove(__t.begin())->__value_);
@@ -1325,7 +1262,6 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
__node_insert_multi(__cache);
__cache = __next;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
@@ -1334,7 +1270,6 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
destroy(__cache);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
if (__cache != nullptr)
{
while (__cache->__parent_ != nullptr)
@@ -1356,7 +1291,7 @@ __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::~__tree()
@@ -1373,7 +1308,7 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd)
destroy(static_cast<__node_pointer>(__nd->__left_));
destroy(static_cast<__node_pointer>(__nd->__right_));
__node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, _STD::addressof(__nd->__value_));
__node_traits::destroy(__na, addressof(__nd->__value_));
__node_traits::deallocate(__na, __nd, 1);
}
}
@@ -1411,8 +1346,8 @@ __tree<_Tp, _Compare, _Allocator>::clear()
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node::base::pointer& __parent,
const value_type& __v)
{
__node_pointer __nd = __root();
@@ -1450,8 +1385,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node::base::pointer& __parent,
const value_type& __v)
{
__node_pointer __nd = __root();
@@ -1492,9 +1427,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointe
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
typename __node_base::pointer& __parent,
typename __node::base::pointer& __parent,
const value_type& __v)
{
if (__hint == end() || !value_comp()(*__hint, __v)) // check before
@@ -1528,8 +1463,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
// If __v exists, set parent to node of __v and return reference to node of __v
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node::base::pointer& __parent,
const _Key& __v)
{
__node_pointer __nd = __root();
@@ -1577,9 +1512,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& _
// If __v exists, set parent to node of __v and return reference to node of __v
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
typename __node_base::pointer& __parent,
typename __node::base::pointer& __parent,
const _Key& __v)
{
if (__hint == end() || value_comp()(__v, *__hint)) // check before
@@ -1609,7 +1544,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
const_iterator __next = _STD::next(__hint);
if (__next == end() || value_comp()(__v, *__next))
{
// *__hint < __v < *_STD::next(__hint)
// *__hint < __v < *next(__hint)
if (__hint.__ptr_->__right_ == nullptr)
{
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
@@ -1645,8 +1580,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_node_at(__node_base_pointer __parent
++size();
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Compare, class _Allocator>
template <class ..._Args>
@@ -1655,7 +1589,7 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
return __h;
}
@@ -1721,18 +1655,23 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
return iterator(static_cast<__node_pointer>(__h.release()));
}
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Compare, class _Allocator>
template <class _V>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
return __r;
__node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__parent, __v);
__node_pointer __r = static_cast<__node_pointer>(__child);
bool __inserted = false;
if (__child == nullptr)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
__inserted = true;
}
return pair<iterator, bool>(iterator(__r), __inserted);
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1740,11 +1679,16 @@ template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
iterator __r = __node_insert_unique(__p, __h.get());
if (__r.__ptr_ == __h.get())
__h.release();
return __r;
__node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__p, __parent, __v);
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
}
return iterator(__r);
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1771,7 +1715,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
return iterator(__h.release());
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
@@ -1779,13 +1723,11 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__na, addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
return _STD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
@@ -1842,6 +1784,8 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
return iterator(__h.release());
}
#endif
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
@@ -1907,7 +1851,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
__begin_node() = __r.__ptr_;
--size();
__node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, const_cast<value_type*>(_STD::addressof(*__p)));
__node_traits::destroy(__na, const_cast<value_type*>(addressof(*__p)));
__tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np));
__node_traits::deallocate(__na, __np, 1);

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,73 +21,35 @@
#include <__tuple_03>
#else // _LIBCPP_HAS_NO_VARIADICS
#else
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
template <class _Tp> class tuple_size;
template <size_t _Ip, class _Tp> class tuple_element;
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<const _Tp>
: public tuple_size<_Tp> {};
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<volatile _Tp>
: public tuple_size<_Tp> {};
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<const volatile _Tp>
: public tuple_size<_Tp> {};
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
template <size_t _Ip, class _Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, const _Tp>
{
public:
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, volatile _Tp>
{
public:
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, const volatile _Tp>
{
public:
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
template <class ..._Tp> class tuple;
template <class _T1, class _T2> class pair;
template <class _Tp, size_t _Size> struct array;
template <class _Tp> struct __tuple_like : false_type {};
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
template <class... _Tp> struct __tuple_like<tuple<_Tp...>> : true_type {};
template <class... _Tp> struct __tuple_like<const tuple<_Tp...>> : true_type {};
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
template <class _T1, class _T2> struct __tuple_like<const 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<const array<_Tp, _Size> > : true_type {};
template <size_t _Ip, class ..._Tp>
typename tuple_element<_Ip, tuple<_Tp...> >::type&
typename tuple_element<_Ip, tuple<_Tp...>>::type&
get(tuple<_Tp...>&);
template <size_t _Ip, class ..._Tp>
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
get(const tuple<_Tp...>&);
template <size_t _Ip, class ..._Tp>
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&);
template <size_t _Ip, class _T1, class _T2>
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&);
@@ -96,10 +58,6 @@ template <size_t _Ip, class _T1, class _T2>
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&);
template <size_t _Ip, class _T1, class _T2>
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&);
template <size_t _Ip, class _Tp, size_t _Size>
_Tp&
get(array<_Tp, _Size>&);
@@ -108,10 +66,6 @@ template <size_t _Ip, class _Tp, size_t _Size>
const _Tp&
get(const array<_Tp, _Size>&);
template <size_t _Ip, class _Tp, size_t _Size>
_Tp&&
get(array<_Tp, _Size>&&);
// __make_tuple_indices
template <size_t...> struct __tuple_indices {};
@@ -143,7 +97,7 @@ struct __make_tuple_indices
template <class ..._Tp> struct __tuple_types {};
template <size_t _Ip>
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
class tuple_element<_Ip, __tuple_types<>>
{
public:
static_assert(_Ip == 0, "tuple_element index out of range");
@@ -151,34 +105,29 @@ public:
};
template <class _Hp, class ..._Tp>
class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...> >
class tuple_element<0, __tuple_types<_Hp, _Tp...>>
{
public:
typedef _Hp type;
};
template <size_t _Ip, class _Hp, class ..._Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
class tuple_element<_Ip, __tuple_types<_Hp, _Tp...>>
{
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>
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
class tuple_size<__tuple_types<_Tp...>>
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...>> : true_type {};
// __make_tuple_types
// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a
// lvalue_reference type, then __tuple_types<_Types&...> is the result.
template <class _TupleTypes, class _Tp, size_t _Sp, size_t _Ep>
struct __make_tuple_types_imp;
@@ -187,7 +136,7 @@ struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
{
typedef typename remove_reference<_Tp>::type _Tpr;
typedef typename __make_tuple_types_imp<__tuple_types<_Types...,
typename conditional<is_lvalue_reference<_Tp>::value,
typename conditional<is_reference<_Tp>::value,
typename tuple_element<_Sp, _Tpr>::type&,
typename tuple_element<_Sp, _Tpr>::type>::type>,
_Tp, _Sp+1, _Ep>::type type;
@@ -206,23 +155,45 @@ struct __make_tuple_types
typedef typename __make_tuple_types_imp<__tuple_types<>, _Tp, _Sp, _Ep>::type type;
};
// __make_assignable_types
template <class _Tuple, class _Tp, size_t _Sp, size_t _Ep>
struct __make_assignable_types_imp;
template <class ..._Types, class _Tp, size_t _Sp, size_t _Ep>
struct __make_assignable_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
{
typedef typename __make_assignable_types_imp<__tuple_types<_Types...,
typename remove_reference<typename tuple_element<_Sp, _Tp>::type>::type>,
_Tp, _Sp+1, _Ep>::type type;
};
template <class ..._Types, class _Tp, size_t _Ep>
struct __make_assignable_types_imp<__tuple_types<_Types...>, _Tp, _Ep, _Ep>
{
typedef __tuple_types<_Types...> type;
};
template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0>
struct __make_assignable_types
{
static_assert(_Sp <= _Ep, "__make_assignable_types input error");
typedef typename __make_assignable_types_imp<__tuple_types<>, typename remove_reference<_Tp>::type, _Sp, _Ep>::type type;
};
// __tuple_convertible
template <bool, class _Tp, class _Up>
struct __tuple_convertible_imp : public false_type {};
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,
#if 1 // waiting on cwg 1170
is_convertible<_Tp0, _Up0>::value &&
#else
is_constructible<_Up0, _Tp0>::value &&
#endif
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...>>::value> {};
template <>
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<>>
: public true_type {};
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
@@ -239,19 +210,6 @@ struct __tuple_convertible<_Tp, _Up, true, true>
// __tuple_assignable
template <bool, class _Tp, class _Up>
struct __tuple_assignable_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
is_assignable<_Up0&, _Tp0>::value &&
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <>
struct __tuple_assignable_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_assignable
@@ -259,9 +217,9 @@ struct __tuple_assignable
template <class _Tp, class _Up>
struct __tuple_assignable<_Tp, _Up, true, true>
: public __tuple_assignable_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>
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
tuple_size<_Up>::value,
typename __make_tuple_types<_Tp>::type, typename __make_assignable_types<_Up>::type>
{};
_LIBCPP_END_NAMESPACE_STD

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -17,9 +17,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
template <class _Tp> class tuple_size;
template <size_t _Ip, class _Tp> class tuple_element;
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___TUPLE_03
#endif

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -256,7 +256,7 @@ template <class RandomAccessIterator, class RandomNumberGenerator>
template<class RandomAccessIterator, class UniformRandomNumberGenerator>
void shuffle(RandomAccessIterator first, RandomAccessIterator last,
UniformRandomNumberGenerator&& g);
UniformRandomNumberGenerator& g);
template <class InputIterator, class Predicate>
bool
@@ -469,29 +469,21 @@ template <class RandomAccessIterator, class Compare>
void
sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
template <class RandomAccessIterator>
template <class RandomAccessIterator>
bool
is_heap(RandomAccessIterator first, RandomAccessiterator last);
is_heap(RandomAccessIterator first, RandomAccessiterator last);
template <class RandomAccessIterator, class Compare>
template <class RandomAccessIterator, class Compare>
bool
is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
template <class RandomAccessIterator>
template <class RandomAccessIterator>
RandomAccessIterator
is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
template <class RandomAccessIterator, class Compare>
template <class RandomAccessIterator, class Compare>
RandomAccessIterator
is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
template <class ForwardIterator>
ForwardIterator
min_element(ForwardIterator first, ForwardIterator last);
template <class ForwardIterator, class Compare>
ForwardIterator
min_element(ForwardIterator first, ForwardIterator last, Compare comp);
is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
template <class T>
const T&
@@ -501,22 +493,6 @@ template <class T, class Compare>
const T&
min(const T& a, const T& b, Compare comp);
template<class T>
T
min(initializer_list<T> t);
template<class T, class Compare>
T
min(initializer_list<T> t, Compare comp);
template <class ForwardIterator>
ForwardIterator
max_element(ForwardIterator first, ForwardIterator last);
template <class ForwardIterator, class Compare>
ForwardIterator
max_element(ForwardIterator first, ForwardIterator last, Compare comp);
template <class T>
const T&
max(const T& a, const T& b);
@@ -525,37 +501,21 @@ template <class T, class Compare>
const T&
max(const T& a, const T& b, Compare comp);
template<class T>
T
max(initializer_list<T> t);
template <class ForwardIterator>
ForwardIterator
min_element(ForwardIterator first, ForwardIterator last);
template<class T, class Compare>
T
max(initializer_list<T> t, Compare comp);
template <class ForwardIterator, class Compare>
ForwardIterator
min_element(ForwardIterator first, ForwardIterator last, Compare comp);
template<class ForwardIterator>
pair<ForwardIterator, ForwardIterator>
minmax_element(ForwardIterator first, ForwardIterator last);
template <class ForwardIterator>
ForwardIterator
max_element(ForwardIterator first, ForwardIterator last);
template<class ForwardIterator, class Compare>
pair<ForwardIterator, ForwardIterator>
minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
template<class T>
pair<const T&, const T&>
minmax(const T& a, const T& b);
template<class T, class Compare>
pair<const T&, const T&>
minmax(const T& a, const T& b, Compare comp);
template<class T>
pair<T, T>
minmax(initializer_list<T> t);
template<class T, class Compare>
pair<T, T>
minmax(initializer_list<T> t, Compare comp);
template <class ForwardIterator, class Compare>
ForwardIterator
max_element(ForwardIterator first, ForwardIterator last, Compare comp);
template <class InputIterator1, class InputIterator2>
bool
@@ -567,7 +527,7 @@ template <class InputIterator1, class InputIterator2, class Compare>
InputIterator2 first2, InputIterator2 last2, Compare comp);
template <class BidirectionalIterator>
bool
bool
next_permutation(BidirectionalIterator first, BidirectionalIterator last);
template <class BidirectionalIterator, class Compare>
@@ -1200,7 +1160,7 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
break;
++__first1;
}
#else // !_LIBCPP_UNROLL_LOOPS
#else // _LIBCPP_UNROLL_LOOPS
for (_D1 __loop_unroll = (__s - __first1) / 4; __loop_unroll > 0; --__loop_unroll)
{
if (__pred(*__first1, *__first2))
@@ -1230,7 +1190,7 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
return __last1;
}
__phase2:
#endif // !_LIBCPP_UNROLL_LOOPS
#endif // _LIBCPP_UNROLL_LOOPS
_RandomAccessIterator1 __m1 = __first1;
_RandomAccessIterator2 __m2 = __first2;
#if !_LIBCPP_UNROLL_LOOPS
@@ -1245,7 +1205,7 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
break;
}
}
#else // !_LIBCPP_UNROLL_LOOPS
#else // _LIBCPP_UNROLL_LOOPS
++__m2;
++__m1;
for (_D2 __loop_unroll = (__last2 - __m2) / 4; __loop_unroll > 0; --__loop_unroll)
@@ -1281,7 +1241,7 @@ __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
}
__continue:
++__first1;
#endif // !_LIBCPP_UNROLL_LOOPS
#endif // _LIBCPP_UNROLL_LOOPS
}
}
@@ -1438,7 +1398,7 @@ template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_trivially_copy_assignable<_Tp>::value,
has_trivial_copy_assign<_Tp>::value,
_Tp*
>::type
__unwrap_iter(move_iterator<_Tp*> __i)
@@ -1450,7 +1410,7 @@ template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_trivially_copy_assignable<_Tp>::value,
has_trivial_copy_assign<_Tp>::value,
_Tp*
>::type
__unwrap_iter(__wrap_iter<_Tp*> __i)
@@ -1473,7 +1433,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_same<typename remove_const<_Tp>::type, _Up>::value &&
is_trivially_copy_assignable<_Up>::value,
has_trivial_copy_assign<_Up>::value,
_Up*
>::type
__copy(_Tp* __first, _Tp* __last, _Up* __result)
@@ -1508,7 +1468,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_same<typename remove_const<_Tp>::type, _Up>::value &&
is_trivially_copy_assignable<_Up>::value,
has_trivial_copy_assign<_Up>::value,
_Up*
>::type
__copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
@@ -1559,17 +1519,8 @@ typename enable_if
>::type
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
{
if (__n > 0)
{
for (; __n > 0; --__n, ++__first, ++__result)
*__result = *__first;
++__result;
for (--__n; __n > 0; --__n)
{
++__first;
*__result = *__first;
++__result;
}
}
return __result;
}
@@ -1582,7 +1533,7 @@ typename enable_if
>::type
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
{
return _STD::copy(__first, __first + __n, __result);
return copy(__first, __first + __n, __result);
}
// move
@@ -1602,7 +1553,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_same<typename remove_const<_Tp>::type, _Up>::value &&
is_trivially_copy_assignable<_Up>::value,
has_trivial_copy_assign<_Up>::value,
_Up*
>::type
__move(_Tp* __first, _Tp* __last, _Up* __result)
@@ -1637,7 +1588,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_same<typename remove_const<_Tp>::type, _Up>::value &&
is_trivially_copy_assignable<_Up>::value,
has_trivial_copy_assign<_Up>::value,
_Up*
>::type
__move_backward(_Tp* __first, _Tp* __last, _Up* __result)
@@ -1775,7 +1726,7 @@ fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
{
return _STD::__fill_n(__first, __n, __value, integral_constant<bool,
is_pointer<_OutputIterator>::value &&
is_trivially_copy_assignable<_Tp>::value &&
has_trivial_copy_assign<_Tp>::value &&
sizeof(_Tp) == 1>());
}
@@ -2004,6 +1955,7 @@ __unique_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __
return __result;
}
template <class _InputIterator, class _OutputIterator, class _BinaryPredicate>
inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator
@@ -2131,7 +2083,7 @@ __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomA
{
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
if (__first == __middle)
return __last;
if (__middle == __last)
@@ -2178,7 +2130,7 @@ rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __l
typename iterator_traits<_ForwardIterator>::iterator_category,
random_access_iterator_tag
>::value &&
is_trivially_copy_assignable
has_trivial_copy_assign
<
typename iterator_traits<_ForwardIterator>::value_type
>::value
@@ -2195,6 +2147,42 @@ rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterato
return _STD::copy(__first, __middle, _STD::copy(__middle, __last, __result));
}
// min
template <class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
const _Tp&
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
return __comp(__b, __a) ? __b : __a;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
const _Tp&
min(const _Tp& __a, const _Tp& __b)
{
return _STD::min(__a, __b, __less<_Tp>());
}
// max
template <class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
const _Tp&
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
return __comp(__a, __b) ? __b : __a;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
const _Tp&
max(const _Tp& __a, const _Tp& __b)
{
return _STD::max(__a, __b, __less<_Tp>());
}
// min_element
template <class _ForwardIterator, class _Compare>
@@ -2217,42 +2205,7 @@ inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
min_element(_ForwardIterator __first, _ForwardIterator __last)
{
return _STD::min_element(__first, __last,
__less<typename iterator_traits<_ForwardIterator>::value_type>());
}
// min
template <class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
const _Tp&
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
return __comp(__b, __a) ? __b : __a;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
const _Tp&
min(const _Tp& __a, const _Tp& __b)
{
return _STD::min(__a, __b, __less<_Tp>());
}
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
_Tp
min(initializer_list<_Tp> __t, _Compare __comp)
{
return *_STD::min_element(__t.begin(), __t.end(), __comp);
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp
min(initializer_list<_Tp> __t)
{
return *_STD::min_element(__t.begin(), __t.end());
return _STD::min_element(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
}
// max_element
@@ -2277,42 +2230,7 @@ inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
max_element(_ForwardIterator __first, _ForwardIterator __last)
{
return _STD::max_element(__first, __last,
__less<typename iterator_traits<_ForwardIterator>::value_type>());
}
// max
template <class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
const _Tp&
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
return __comp(__a, __b) ? __b : __a;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
const _Tp&
max(const _Tp& __a, const _Tp& __b)
{
return _STD::max(__a, __b, __less<_Tp>());
}
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
_Tp
max(initializer_list<_Tp> __t, _Compare __comp)
{
return *_STD::max_element(__t.begin(), __t.end(), __comp);
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp
max(initializer_list<_Tp> __t)
{
return *_STD::max_element(__t.begin(), __t.end());
return _STD::max_element(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
}
// minmax_element
@@ -2375,45 +2293,6 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last)
return _STD::minmax_element(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
}
// minmax
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
pair<const _Tp&, const _Tp&>
minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) :
pair<const _Tp&, const _Tp&>(__a, __b);
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
pair<const _Tp&, const _Tp&>
minmax(const _Tp& __a, const _Tp& __b)
{
return _STD::minmax(__a, __b, __less<_Tp>());
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
pair<_Tp, _Tp>
minmax(initializer_list<_Tp> __t)
{
pair<const _Tp*, const _Tp*> __p =
_STD::minmax_element(__t.begin(), __t.end());
return pair<_Tp, _Tp>(*__p.first, *__p.second);
}
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
pair<_Tp, _Tp>
minmax(initializer_list<_Tp> __t, _Compare __comp)
{
pair<const _Tp*, const _Tp*> __p =
_STD::minmax_element(__t.begin(), __t.end(), __comp);
return pair<_Tp, _Tp>(*__p.first, *__p.second);
}
// random_shuffle
// __independent_bits_engine
@@ -2695,18 +2574,14 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
_D __uid;
__rs_default __g = __rs_get();
for (--__last, --__d; __first < __last; ++__first, --__d)
{
difference_type __i = __uid(__g, _P(0, __d));
if (__i != difference_type(0))
swap(*__first, *(__first + __i));
}
swap(*__first, *(__first + __uid(__g, _P(0, __d))));
}
}
template <class _RandomAccessIterator, class _RandomNumberGenerator>
void
random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
_RandomNumberGenerator&& __rand)
#else
_RandomNumberGenerator& __rand)
@@ -2717,20 +2592,13 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
if (__d > 1)
{
for (--__last; __first < __last; ++__first, --__d)
{
difference_type __i = __rand(__d);
swap(*__first, *(__first + __i));
}
swap(*__first, *(__first + __rand(__d)));
}
}
template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_UniformRandomNumberGenerator&& __g)
#else
_UniformRandomNumberGenerator& __g)
#endif
{
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef uniform_int_distribution<ptrdiff_t> _D;
@@ -2740,11 +2608,7 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
{
_D __uid;
for (--__last, --__d; __first < __last; ++__first, --__d)
{
difference_type __i = __uid(__g, _P(0, __d));
if (__i != difference_type(0))
swap(*__first, *(__first + __i));
}
swap(*__first, *(__first + __uid(__g, _P(0, __d))));
}
}
@@ -3170,7 +3034,7 @@ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __co
return __last;
}
template<class _ForwardIterator>
template<class _ForwardIterator>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
@@ -3188,7 +3052,7 @@ is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
return _STD::is_sorted_until(__first, __last, __comp) == __last;
}
template<class _ForwardIterator>
template<class _ForwardIterator>
inline _LIBCPP_INLINE_VISIBILITY
bool
is_sorted(_ForwardIterator __first, _ForwardIterator __last)
@@ -3443,8 +3307,8 @@ __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __c
// _Compare is known to be a reference type
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
const difference_type __limit = is_trivially_copy_constructible<value_type>::value &&
is_trivially_copy_assignable<value_type>::value ? 30 : 6;
const difference_type __limit = has_trivial_copy_constructor<value_type>::value &&
has_trivial_copy_assign<value_type>::value ? 30 : 6;
while (true)
{
__restart:
@@ -3639,10 +3503,10 @@ sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __com
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__sort<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__sort<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _RandomAccessIterator>
@@ -3736,10 +3600,10 @@ lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __lower_bound<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __lower_bound<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _ForwardIterator, class _Tp>
@@ -3784,10 +3648,10 @@ upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __upper_bound<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __upper_bound<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _ForwardIterator, class _Tp>
@@ -3844,10 +3708,10 @@ equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __equal_range<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __equal_range<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _ForwardIterator, class _Tp>
@@ -3879,10 +3743,10 @@ binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __binary_search<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __binary_search<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _ForwardIterator, class _Tp>
@@ -3929,10 +3793,10 @@ merge(_InputIterator1 __first1, _InputIterator1 __last1,
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return _STD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return _STD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -4078,7 +3942,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
template <class _Tp>
struct __inplace_merge_switch
{
static const unsigned value = is_trivially_copy_assignable<_Tp>::value;
static const unsigned value = has_trivial_copy_assign<_Tp>::value;
};
template <class _BidirectionalIterator, class _Compare>
@@ -4104,11 +3968,11 @@ inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _
__debug_less<_Compare> __c(__comp);
return _STD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __c, __len1, __len2,
__buf.first, __buf.second);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return _STD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,
__buf.first, __buf.second);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _BidirectionalIterator>
@@ -4246,7 +4110,7 @@ __stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1
template <class _Tp>
struct __stable_sort_switch
{
static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value;
static const unsigned value = 128*has_trivial_copy_assign<_Tp>::value;
};
template <class _Compare, class _RandomAccessIterator>
@@ -4314,10 +4178,10 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__stable_sort<_Comp_ref>(__first, __last, __c, __len, __buf.first, __buf.second);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _RandomAccessIterator>
@@ -4357,7 +4221,7 @@ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
return __last;
}
template<class _RandomAccessIterator>
template<class _RandomAccessIterator>
inline _LIBCPP_INLINE_VISIBILITY
_RandomAccessIterator
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
@@ -4375,7 +4239,7 @@ is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __
return _STD::is_heap_until(__first, __last, __comp) == __last;
}
template<class _RandomAccessIterator>
template<class _RandomAccessIterator>
inline _LIBCPP_INLINE_VISIBILITY
bool
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
@@ -4463,10 +4327,10 @@ push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__push_heap_back<_Comp_ref>(__first, __last, __c, __last - __first);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__push_heap_back<_Comp_ref>(__first, __last, __comp, __last - __first);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _RandomAccessIterator>
@@ -4501,10 +4365,10 @@ pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare _
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__pop_heap<_Comp_ref>(__first, __last, __c, __last - __first);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _RandomAccessIterator>
@@ -4541,10 +4405,10 @@ make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__make_heap<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__make_heap<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _RandomAccessIterator>
@@ -4575,10 +4439,10 @@ sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__sort_heap<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__sort_heap<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _RandomAccessIterator>
@@ -4619,10 +4483,10 @@ partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__partial_sort<_Comp_ref>(__first, __middle, __last, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _RandomAccessIterator>
@@ -4669,10 +4533,10 @@ partial_sort_copy(_InputIterator __first, _InputIterator __last,
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _InputIterator, class _RandomAccessIterator>
@@ -4881,10 +4745,10 @@ nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomA
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__nth_element<_Comp_ref>(__first, __nth, __last, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__nth_element<_Comp_ref>(__first, __nth, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _RandomAccessIterator>
@@ -4922,10 +4786,10 @@ includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _InputIterator1, class _InputIterator2>
@@ -4975,10 +4839,10 @@ set_union(_InputIterator1 __first1, _InputIterator1 __last1,
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5027,10 +4891,10 @@ set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5081,10 +4945,10 @@ set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5140,10 +5004,10 @@ set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5184,10 +5048,10 @@ lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _InputIterator1, class _InputIterator2>
@@ -5239,15 +5103,15 @@ next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last,
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __next_permutation<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __next_permutation<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _BidirectionalIterator>
inline _LIBCPP_INLINE_VISIBILITY
bool
bool
next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
{
return _STD::next_permutation(__first, __last,
@@ -5292,10 +5156,10 @@ prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last,
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __prev_permutation<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG
#else
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __prev_permutation<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _BidirectionalIterator>

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -16,85 +16,84 @@
namespace std
{
template <class T, size_t N >
template <class T, size_t N >
struct array
{
// types:
typedef T & reference;
typedef const T & const_reference;
typedef implementation defined iterator;
typedef implementation defined const_iterator;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T value_type;
{
// types:
typedef T & reference;
typedef const T & const_reference;
typedef implementation defined iterator;
typedef implementation defined const_iterator;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// No explicit construct/copy/destroy for aggregate type
void fill(const T& u);
// No explicit construct/copy/destroy for aggregate type
void fill(const T& u);
void swap(array& a);
// iterators:
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
// iterators:
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
reverse_iterator rbegin();
const_reverse_iterator rbegin() const;
reverse_iterator rend();
const_reverse_iterator rend() const;
reverse_iterator rbegin();
const_reverse_iterator rbegin() const;
reverse_iterator rend();
const_reverse_iterator rend() const;
const_iterator cbegin() const;
const_iterator cend() const;
const_iterator cbegin() const;
const_iterator cend() const;
const_reverse_iterator crbegin() const;
const_reverse_iterator crend() const;
const_reverse_iterator crend() const;
// capacity:
constexpr size_type size() const;
constexpr size_type max_size() const;
bool empty() const;
// capacity:
constexpr size_type size() const;
constexpr size_type max_size() const;
bool empty() const;
// element access:
reference operator[](size_type n);
const_reference operator[](size_type n) const;
const_reference at(size_type n) const;
reference at(size_type n);
// element access:
reference operator[](size_type n);
const_reference operator[](size_type n) const;
const_reference at(size_type n) const;
reference at(size_type n);
reference front();
const_reference front() const;
reference back();
const_reference back() const;
reference front();
const_reference front() const;
reference back();
const_reference back() const;
T* data();
const T* data() const;
T* data();
const T* data() const;
};
template <class T, size_t N>
bool operator==(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator!=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator<(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator>(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator<=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator>=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator==(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator!=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator<(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator>(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator<=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator>=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N >
void swap(array<T,N>& x, array<T,N>& y);
template <class T, size_t N >
void swap(array<T,N>& x, array<T,N>& y);
template <class T> class tuple_size;
template <int I, class T> class tuple_element;
template <class T> class tuple_size;
template <int I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N>>;
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&);
template <int I, class T, size_t N> const T& get(const array<T, N>&);
template <int I, class T, size_t N> T&& get(array<T, N>&&);
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&);
template <int I, class T, size_t N> const T& get(const array<T, N>&);
} // std
@@ -115,32 +114,30 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&);
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
struct _LIBCPP_VISIBLE array
template <class _Tp, size_t _Size>
struct array
{
// types:
typedef array __self;
typedef _Tp value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef _Tp value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
value_type __elems_[_Size > 0 ? _Size : 1];
// No explicit construct/copy/destroy for aggregate type
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
{_STD::fill_n(__elems_, _Size, __u);}
_LIBCPP_INLINE_VISIBILITY void swap(array& __a)
{_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
// No explicit construct/copy/destroy for aggregate type
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) {_STD::fill_n(__elems_, _Size, __u);}
_LIBCPP_INLINE_VISIBILITY void swap(array& __a) {_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
// iterators:
// iterators:
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__elems_);}
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(__elems_);}
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__elems_ + _Size);}
@@ -156,16 +153,16 @@ struct _LIBCPP_VISIBLE array
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const {return rend();}
// capacity:
// capacity:
_LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type size() const {return _Size;}
_LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type max_size() const {return _Size;}
_LIBCPP_INLINE_VISIBILITY bool empty() const {return _Size == 0;}
// element access:
// element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __elems_[__n];}
reference at(size_type __n);
const_reference at(size_type __n) const;
reference at(size_type __n);
const_reference at(size_type __n) const;
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return __elems_[0];}
@@ -173,10 +170,10 @@ struct _LIBCPP_VISIBLE array
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY value_type* data() {return __elems_;}
_LIBCPP_INLINE_VISIBILITY const value_type* data() const {return __elems_;}
_LIBCPP_INLINE_VISIBILITY const value_type* data() const {return __elems_;}
};
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
typename array<_Tp, _Size>::reference
array<_Tp, _Size>::at(size_type __n)
{
@@ -189,7 +186,7 @@ array<_Tp, _Size>::at(size_type __n)
return __elems_[__n];
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
typename array<_Tp, _Size>::const_reference
array<_Tp, _Size>::at(size_type __n) const
{
@@ -202,7 +199,7 @@ array<_Tp, _Size>::at(size_type __n) const
return __elems_[__n];
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -210,7 +207,7 @@ operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
return _STD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -218,7 +215,7 @@ operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
return !(__x == __y);
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -226,7 +223,7 @@ operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
return _STD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -234,7 +231,7 @@ operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
return __y < __x;
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -242,7 +239,7 @@ operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
return !(__y < __x);
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -250,7 +247,7 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
return !(__x < __y);
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -259,22 +256,20 @@ swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
class tuple_size<array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
template <class _Tp, size_t _Size>
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
class tuple_size<const array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
class tuple_element<_Ip, array<_Tp, _Size> >
{
public:
typedef _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
class tuple_element<_Ip, const array<_Tp, _Size> >
{
public:
typedef const _Tp type;
@@ -296,18 +291,6 @@ get(const array<_Tp, _Size>& __a)
return __a[_Ip];
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
_Tp&&
get(array<_Tp, _Size>&& __a)
{
return _STD::move(__a[_Ip]);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_ARRAY

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -40,10 +40,7 @@ public:
// 23.3.5.1 constructors:
constexpr bitset();
constexpr bitset(unsigned long long val);
template <class charT>
explicit bitset(const charT* str,
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
charT zero = charT('0'), charT one = charT('1'));
explicit bitset( const char* str );
template<class charT, class traits, class Allocator>
explicit bitset(const basic_string<charT,traits,Allocator>& str,
typename basic_string<charT,traits,Allocator>::size_type pos = 0,
@@ -595,88 +592,81 @@ template <size_t _Size> class bitset;
template <size_t _Size> struct hash<bitset<_Size> >;
template <size_t _Size>
class _LIBCPP_VISIBLE bitset
class bitset
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
{
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
typedef __bitset<__n_words, _Size> base;
public:
public:
typedef typename base::reference reference;
typedef typename base::const_reference const_reference;
// 23.3.5.1 constructors:
// 23.3.5.1 constructors:
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() {}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) : base(__v) {}
template<class _CharT>
explicit bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
template<class _CharT, class _Traits, class _Allocator>
explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __n =
explicit bitset(const char* __str);
template<class _CharT, class _Traits, class _Allocator>
explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __n =
(basic_string<_CharT,_Traits,_Allocator>::npos),
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
// 23.3.5.2 bitset operations:
// 23.3.5.2 bitset operations:
bitset& operator&=(const bitset& __rhs);
bitset& operator|=(const bitset& __rhs);
bitset& operator^=(const bitset& __rhs);
bitset& operator<<=(size_t __pos);
bitset& operator>>=(size_t __pos);
bitset& set();
bitset& set(size_t __pos, bool __val = true);
bitset& reset();
bitset& reset(size_t __pos);
bitset operator~() const;
bitset& flip();
bitset& flip(size_t __pos);
bitset& operator|=(const bitset& __rhs);
bitset& operator^=(const bitset& __rhs);
bitset& operator<<=(size_t __pos);
bitset& operator>>=(size_t __pos);
bitset& set();
bitset& set(size_t __pos, bool __val = true);
bitset& reset();
bitset& reset(size_t __pos);
bitset operator~() const;
bitset& flip();
bitset& flip(size_t __pos);
// element access:
// element access:
_LIBCPP_INLINE_VISIBILITY 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);}
unsigned long to_ulong() const;
unsigned long long to_ullong() const;
template <class _CharT, class _Traits, class _Allocator>
unsigned long to_ulong() const;
unsigned long long to_ullong() const;
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
template <class _CharT, class _Traits>
_CharT __one = _CharT('1')) const;
template <class _CharT, class _Traits>
basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
template <class _CharT>
_CharT __one = _CharT('1')) const;
template <class _CharT>
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
_CharT __one = _CharT('1')) const;
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;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const {return _Size;}
bool operator==(const bitset& __rhs) const;
bool operator!=(const bitset& __rhs) const;
bool test(size_t __pos) const;
bool all() const;
bool any() const;
bool operator==(const bitset& __rhs) const;
bool operator!=(const bitset& __rhs) const;
bool test(size_t __pos) const;
bool all() const;
bool any() const;
_LIBCPP_INLINE_VISIBILITY bool none() const {return !any();}
bitset operator<<(size_t __pos) const;
bitset operator>>(size_t __pos) const;
bitset operator<<(size_t __pos) const;
bitset operator>>(size_t __pos) const;
private:
_LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const {return base::__hash_code();}
friend struct hash<bitset>;
};
template <size_t _Size>
template<class _CharT>
bitset<_Size>::bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n,
_CharT __zero, _CharT __one)
bitset<_Size>::bitset(const char* __str)
{
size_t __rlen = _STD::min(__n, char_traits<_CharT>::length(__str));
size_t __rlen = strlen(__str);
for (size_t __i = 0; __i < __rlen; ++__i)
if (__str[__i] != __zero && __str[__i] != __one)
if (__str[__i] != '0' && __str[__i] != '1')
#ifndef _LIBCPP_NO_EXCEPTIONS
throw invalid_argument("bitset string ctor has invalid argument");
#else
@@ -686,19 +676,23 @@ bitset<_Size>::bitset(const _CharT* __str,
size_t __i = 0;
for (; __i < _M; ++__i)
{
_CharT __c = __str[_M - 1 - __i];
if (__c == __zero)
switch (__str[_M - 1 - __i])
{
case '0':
(*this)[__i] = false;
else
break;
case '1':
(*this)[__i] = true;
break;
}
}
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
}
template <size_t _Size>
template<class _CharT, class _Traits, class _Allocator>
bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos,
template<class _CharT, class _Traits, class _Allocator>
bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __n,
_CharT __zero, _CharT __one)
{
@@ -873,7 +867,7 @@ bitset<_Size>::to_ullong() const
}
template <size_t _Size>
template <class _CharT, class _Traits, class _Allocator>
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
{
@@ -887,7 +881,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
}
template <size_t _Size>
template <class _CharT, class _Traits>
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, allocator<_CharT> >
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
@@ -896,7 +890,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
}
template <size_t _Size>
template <class _CharT>
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
@@ -1016,10 +1010,9 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y)
}
template <size_t _Size>
struct _LIBCPP_VISIBLE hash<bitset<_Size> >
struct hash<bitset<_Size> >
: public unary_function<bitset<_Size>, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const bitset<_Size>& __bs) const
{return __bs.__hash_code();}
};

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -30,46 +30,28 @@ Macros:
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
#ifdef ELAST
const int __elast1 = ELAST+1;
const int __elast2 = ELAST+2;
#else
const int __elast1 = 104;
const int __elast2 = 105;
#endif
#undef ELAST
#ifdef ENOTRECOVERABLE
#define EOWNERDEAD __elast1
#ifdef ELAST
#undef ELAST
#define ELAST EOWNERDEAD
#endif
#elif defined(EOWNERDEAD)
#define ENOTRECOVERABLE __elast1
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE
#endif
#else // defined(EOWNERDEAD)
#else
#define EOWNERDEAD __elast1
#define ENOTRECOVERABLE __elast2
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE
#endif
#endif // defined(EOWNERDEAD)
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
#endif
#endif // _LIBCPP_CERRNO

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -223,26 +223,26 @@ public:
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock> time_point;
static const bool is_steady = false;
static const bool is_monotonic = false;
static time_point now();
static time_t to_time_t (const time_point& __t);
static time_point from_time_t(time_t __t);
};
class steady_clock
class monotonic_clock
{
public:
typedef nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<steady_clock, duration> time_point;
static const bool is_steady = true;
typedef chrono::time_point<monotonic_clock, duration> time_point;
static const bool is_monotonic = true;
static time_point now();
};
typedef steady_clock high_resolution_clock;
typedef monotonic_clock high_resolution_clock;
} // chrono
@@ -262,7 +262,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono
{
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_VISIBLE duration;
template <class _Rep, class _Period = ratio<1> > class duration;
template <class _Tp>
struct __is_duration : false_type {};
@@ -282,8 +282,7 @@ struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
} // chrono
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
struct _LIBCPP_VISIBLE common_type<chrono::duration<_Rep1, _Period1>,
chrono::duration<_Rep2, _Period2> >
struct common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2> >
{
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
typename __ratio_gcd<_Period1, _Period2>::type> type;
@@ -358,11 +357,10 @@ duration_cast(const duration<_Rep, _Period>& __fd)
return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
}
template <class _Rep>
struct _LIBCPP_VISIBLE treat_as_floating_point : is_floating_point<_Rep> {};
template <class _Rep> struct treat_as_floating_point : is_floating_point<_Rep> {};
template <class _Rep>
struct _LIBCPP_VISIBLE duration_values
struct duration_values
{
public:
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
@@ -373,7 +371,7 @@ public:
// duration
template <class _Rep, class _Period>
class _LIBCPP_VISIBLE duration
class 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");
@@ -669,7 +667,7 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
//////////////////////////////////////////////////////////
template <class _Clock, class _Duration = typename _Clock::duration>
class _LIBCPP_VISIBLE time_point
class time_point
{
static_assert(__is_duration<_Duration>::value,
"Second template parameter of time_point must be a std::chrono::duration");
@@ -713,8 +711,7 @@ public:
} // chrono
template <class _Clock, class _Duration1, class _Duration2>
struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
chrono::time_point<_Clock, _Duration2> >
struct common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2> >
{
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
};
@@ -836,33 +833,33 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
/////////////////////// clocks ///////////////////////////
//////////////////////////////////////////////////////////
class _LIBCPP_VISIBLE system_clock
class system_clock
{
public:
typedef microseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock> time_point;
static const bool is_steady = false;
static const bool is_monotonic = false;
static time_point now();
static time_t to_time_t (const time_point& __t);
static time_point from_time_t(time_t __t);
};
class _LIBCPP_VISIBLE steady_clock
class monotonic_clock
{
public:
typedef nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<steady_clock, duration> time_point;
static const bool is_steady = true;
typedef chrono::time_point<monotonic_clock, duration> time_point;
static const bool is_monotonic = true;
static time_point now();
};
typedef steady_clock high_resolution_clock;
typedef monotonic_clock high_resolution_clock;
} // chrono

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -177,7 +177,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_VISIBLE codecvt_utf8
class codecvt_utf8
: public __codecvt_utf8<_Elem>
{
public:
@@ -185,7 +185,6 @@ public:
explicit codecvt_utf8(size_t __refs = 0)
: __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
_LIBCPP_ALWAYS_INLINE
~codecvt_utf8() {}
};
@@ -405,7 +404,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_VISIBLE codecvt_utf16
class codecvt_utf16
: public __codecvt_utf16<_Elem, _Mode & little_endian>
{
public:
@@ -413,7 +412,6 @@ public:
explicit codecvt_utf16(size_t __refs = 0)
: __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
_LIBCPP_ALWAYS_INLINE
~codecvt_utf16() {}
};
@@ -528,7 +526,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_VISIBLE codecvt_utf8_utf16
class codecvt_utf8_utf16
: public __codecvt_utf8_utf16<_Elem>
{
public:
@@ -536,7 +534,6 @@ public:
explicit codecvt_utf8_utf16(size_t __refs = 0)
: __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
_LIBCPP_ALWAYS_INLINE
~codecvt_utf8_utf16() {}
};

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -49,89 +49,89 @@ public:
template<>
class complex<float>
{
public:
typedef float value_type;
{
public:
typedef float value_type;
constexpr complex(float re = 0.0f, float im = 0.0f);
explicit constexpr complex(const complex<double>&);
explicit constexpr complex(const complex<long double>&);
constexpr complex(float re = 0.0f, float im = 0.0f);
explicit constexpr complex(const complex<double>&);
explicit constexpr complex(const complex<long double>&);
constexpr float real() const;
constexpr float real() const;
void real(float);
constexpr float imag() const;
constexpr float imag() const;
void imag(float);
complex<float>& operator= (float);
complex<float>& operator+=(float);
complex<float>& operator-=(float);
complex<float>& operator*=(float);
complex<float>& operator/=(float);
complex<float>& operator= (float);
complex<float>& operator+=(float);
complex<float>& operator-=(float);
complex<float>& operator*=(float);
complex<float>& operator/=(float);
complex<float>& operator=(const complex<float>&);
template<class X> complex<float>& operator= (const complex<X>&);
template<class X> complex<float>& operator+=(const complex<X>&);
template<class X> complex<float>& operator-=(const complex<X>&);
template<class X> complex<float>& operator*=(const complex<X>&);
template<class X> complex<float>& operator/=(const complex<X>&);
complex<float>& operator=(const complex<float>&);
template<class X> complex<float>& operator= (const complex<X>&);
template<class X> complex<float>& operator+=(const complex<X>&);
template<class X> complex<float>& operator-=(const complex<X>&);
template<class X> complex<float>& operator*=(const complex<X>&);
template<class X> complex<float>& operator/=(const complex<X>&);
};
template<>
class complex<double>
{
public:
typedef double value_type;
{
public:
typedef double value_type;
constexpr complex(double re = 0.0, double im = 0.0);
constexpr complex(const complex<float>&);
explicit constexpr complex(const complex<long double>&);
constexpr complex(double re = 0.0, double im = 0.0);
constexpr complex(const complex<float>&);
explicit constexpr complex(const complex<long double>&);
constexpr double real() const;
constexpr double real() const;
void real(double);
constexpr double imag() const;
constexpr double imag() const;
void imag(double);
complex<double>& operator= (double);
complex<double>& operator+=(double);
complex<double>& operator-=(double);
complex<double>& operator*=(double);
complex<double>& operator/=(double);
complex<double>& operator=(const complex<double>&);
complex<double>& operator= (double);
complex<double>& operator+=(double);
complex<double>& operator-=(double);
complex<double>& operator*=(double);
complex<double>& operator/=(double);
complex<double>& operator=(const complex<double>&);
template<class X> complex<double>& operator= (const complex<X>&);
template<class X> complex<double>& operator+=(const complex<X>&);
template<class X> complex<double>& operator-=(const complex<X>&);
template<class X> complex<double>& operator*=(const complex<X>&);
template<class X> complex<double>& operator/=(const complex<X>&);
};
template<class X> complex<double>& operator= (const complex<X>&);
template<class X> complex<double>& operator+=(const complex<X>&);
template<class X> complex<double>& operator-=(const complex<X>&);
template<class X> complex<double>& operator*=(const complex<X>&);
template<class X> complex<double>& operator/=(const complex<X>&);
};
template<>
class complex<long double>
{
public:
typedef long double value_type;
{
public:
typedef long double value_type;
constexpr complex(long double re = 0.0L, long double im = 0.0L);
constexpr complex(const complex<float>&);
constexpr complex(const complex<double>&);
constexpr complex(long double re = 0.0L, long double im = 0.0L);
constexpr complex(const complex<float>&);
constexpr complex(const complex<double>&);
constexpr long double real() const;
constexpr long double real() const;
void real(long double);
constexpr long double imag() const;
constexpr long double imag() const;
void imag(long double);
complex<long double>& operator=(const complex<long double>&);
complex<long double>& operator= (long double);
complex<long double>& operator+=(long double);
complex<long double>& operator-=(long double);
complex<long double>& operator*=(long double);
complex<long double>& operator/=(long double);
complex<long double>& operator=(const complex<long double>&);
complex<long double>& operator= (long double);
complex<long double>& operator+=(long double);
complex<long double>& operator-=(long double);
complex<long double>& operator*=(long double);
complex<long double>& operator/=(long double);
template<class X> complex<long double>& operator= (const complex<X>&);
template<class X> complex<long double>& operator+=(const complex<X>&);
template<class X> complex<long double>& operator-=(const complex<X>&);
template<class X> complex<long double>& operator*=(const complex<X>&);
template<class X> complex<long double>& operator/=(const complex<X>&);
template<class X> complex<long double>& operator= (const complex<X>&);
template<class X> complex<long double>& operator+=(const complex<X>&);
template<class X> complex<long double>& operator-=(const complex<X>&);
template<class X> complex<long double>& operator*=(const complex<X>&);
template<class X> complex<long double>& operator/=(const complex<X>&);
};
// 26.3.6 operators:
@@ -191,17 +191,17 @@ template<class T> T norm(const complex<T>&);
template<Integral T> double norm(T);
float norm(float);
template<class T> complex<T> conj(const complex<T>&);
complex<long double> conj(long double);
complex<double> conj(double);
template<Integral T> complex<double> conj(T);
complex<float> conj(float);
template<class T> complex<T> conj(const complex<T>&);
long double conj(long double);
double conj(double);
template<Integral T> double conj(T);
float conj(float);
template<class T> complex<T> proj(const complex<T>&);
complex<long double> proj(long double);
complex<double> proj(double);
template<Integral T> complex<double> proj(T);
complex<float> proj(float);
template<class T> complex<T> proj(const complex<T>&);
long double proj(long double);
double proj(double);
template<Integral T> double proj(T);
float proj(float);
template<class T> complex<T> polar(const T&, const T& = 0);
@@ -253,13 +253,13 @@ template<class T, class charT, class traits>
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp> class _LIBCPP_VISIBLE complex;
template<class _Tp> class complex;
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
template<class _Tp>
class _LIBCPP_VISIBLE complex
class complex
{
public:
typedef _Tp value_type;
@@ -316,16 +316,16 @@ public:
}
};
template<> class _LIBCPP_VISIBLE complex<double>;
template<> class _LIBCPP_VISIBLE complex<long double>;
template<> class complex<double>;
template<> class complex<long double>;
template<>
class _LIBCPP_VISIBLE complex<float>
{
class complex<float>
{
float __re_;
float __im_;
public:
typedef float value_type;
public:
typedef float value_type;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f)
: __re_(__re), __im_(__im) {}
@@ -375,12 +375,12 @@ public:
};
template<>
class _LIBCPP_VISIBLE complex<double>
{
class complex<double>
{
double __re_;
double __im_;
public:
typedef double value_type;
public:
typedef double value_type;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0)
: __re_(__re), __im_(__im) {}
@@ -427,15 +427,15 @@ public:
*this = *this / __c;
return *this;
}
};
};
template<>
class _LIBCPP_VISIBLE complex<long double>
{
class complex<long double>
{
long double __re_;
long double __im_;
public:
typedef long double value_type;
public:
typedef long double value_type;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L)
: __re_(__re), __im_(__im) {}
@@ -781,6 +781,20 @@ operator!=(const _Tp& __x, const complex<_Tp>& __y)
return !(__x == __y);
}
/*
Move to <istream>
template<class T, class charT, class traits>
basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>&, complex<T>&);
Move to <ostream>
template<class T, class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>&, const complex<T>&);
*/
// 26.3.7 values:
// real
@@ -980,17 +994,17 @@ conj(const complex<_Tp>& __c)
}
inline _LIBCPP_INLINE_VISIBILITY
complex<long double>
long double
conj(long double __re)
{
return complex<long double>(__re);
return __re;
}
inline _LIBCPP_INLINE_VISIBILITY
complex<double>
double
conj(double __re)
{
return complex<double>(__re);
return __re;
}
template<class _Tp>
@@ -998,18 +1012,18 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
complex<double>
double
>::type
conj(_Tp __re)
{
return complex<double>(__re);
return __re;
}
inline _LIBCPP_INLINE_VISIBILITY
complex<float>
float
conj(float __re)
{
return complex<float>(__re);
return __re;
}
// proj
@@ -1026,21 +1040,21 @@ proj(const complex<_Tp>& __c)
}
inline _LIBCPP_INLINE_VISIBILITY
complex<long double>
long double
proj(long double __re)
{
if (isinf(__re))
__re = abs(__re);
return complex<long double>(__re);
return __re;
}
inline _LIBCPP_INLINE_VISIBILITY
complex<double>
double
proj(double __re)
{
if (isinf(__re))
__re = abs(__re);
return complex<double>(__re);
return __re;
}
template<class _Tp>
@@ -1048,20 +1062,20 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
complex<double>
double
>::type
proj(_Tp __re)
{
return complex<double>(__re);
return __re;
}
inline _LIBCPP_INLINE_VISIBILITY
complex<float>
float
proj(float __re)
{
if (isinf(__re))
__re = abs(__re);
return complex<float>(__re);
return __re;
}
// polar

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -18,16 +18,8 @@
*/
#ifdef __cplusplus
#include <ccomplex>
#else // __cplusplus
#include_next <complex.h>
#endif // __cplusplus
#pragma GCC system_header
#endif // _LIBCPP_COMPLEX_H

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -61,8 +61,6 @@ public:
native_handle_type native_handle();
};
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
class condition_variable_any
{
public:
@@ -115,7 +113,7 @@ public:
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_VISIBLE condition_variable_any
class condition_variable_any
{
condition_variable __cv_;
shared_ptr<mutex> __mut_;
@@ -153,11 +151,11 @@ public:
_Predicate __pred);
};
inline _LIBCPP_INLINE_VISIBILITY
inline
condition_variable_any::condition_variable_any()
: __mut_(make_shared<mutex>()) {}
inline _LIBCPP_INLINE_VISIBILITY
inline
void
condition_variable_any::notify_one()
{
@@ -165,7 +163,7 @@ condition_variable_any::notify_one()
__cv_.notify_one();
}
inline _LIBCPP_INLINE_VISIBILITY
inline
void
condition_variable_any::notify_all()
{
@@ -192,7 +190,7 @@ condition_variable_any::wait(_Lock& __lock)
} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
{
@@ -214,7 +212,7 @@ condition_variable_any::wait_until(_Lock& __lock,
} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Clock, class _Duration, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
condition_variable_any::wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t,
@@ -227,28 +225,25 @@ condition_variable_any::wait_until(_Lock& __lock,
}
template <class _Lock, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
inline
cv_status
condition_variable_any::wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d)
{
return wait_until(__lock, chrono::steady_clock::now() + __d);
return wait_until(__lock, chrono::monotonic_clock::now() + __d);
}
template <class _Lock, class _Rep, class _Period, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
condition_variable_any::wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred)
{
return wait_until(__lock, chrono::steady_clock::now() + __d,
return wait_until(__lock, chrono::monotonic_clock::now() + __d,
_STD::move(__pred));
}
_LIBCPP_VISIBLE
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_CONDITION_VARIABLE

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -25,7 +25,7 @@ Macros:
SIGINT
SIGSEGV
SIGTERM
namespace std
{

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -20,7 +20,7 @@ Macros:
void va_copy(va_list dest, va_list src); // C99
void va_end(va_list ap);
void va_start(va_list ap, parmN);
namespace std
{

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -18,7 +18,7 @@ Macros:
offsetof(type,member-designator)
NULL
namespace std
{
@@ -39,7 +39,7 @@ Types:
#define __need_NULL
#define __need_ptrdiff_t
#define __need_size_t
#endif // __GLIBC__
#endif
#include <stddef.h>
@@ -54,7 +54,7 @@ typedef long double max_align_t;
#ifdef _LIBCPP_HAS_NO_NULLPTR
struct _LIBCPP_VISIBLE nullptr_t
struct nullptr_t
{
void* _;
@@ -65,11 +65,11 @@ struct _LIBCPP_VISIBLE nullptr_t
_LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
template <class _Tp>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_ALWAYS_INLINE
operator _Tp* () const {return 0;}
template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;}
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
@@ -84,11 +84,11 @@ inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
#define nullptr _STD::__get_nullptr_t()
#else // _LIBCPP_HAS_NO_NULLPTR
#else
typedef decltype(nullptr) nullptr_t;
#endif // _LIBCPP_HAS_NO_NULLPTR
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,7 +21,7 @@ Macros:
MB_CUR_MAX
NULL
RAND_MAX
namespace std
{
@@ -66,7 +66,7 @@ long labs( long j);
long long llabs(long long j); // C99
div_t div( int numer, int denom);
ldiv_t div( long numer, long denom);
lldiv_t div(long long numer, long long denom); // C++0X
lldiv_t div(long long numer, long long denom); // C++0X
ldiv_t ldiv( long numer, long denom);
lldiv_t lldiv(long long numer, long long denom); // C99
int mblen(const char* s, size_t n);

View File

@@ -17,7 +17,7 @@
Macros:
NULL
namespace std
{
@@ -77,27 +77,24 @@ using ::strncmp;
using ::strcoll;
using ::strxfrm;
using ::memchr;
inline _LIBCPP_INLINE_VISIBILITY const void* memchr(const void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
using ::strchr;
inline _LIBCPP_INLINE_VISIBILITY const char* strchr(const char* __s, int __c) {return ::strchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
using ::strcspn;
using ::strpbrk;
inline _LIBCPP_INLINE_VISIBILITY const char* strpbrk(const char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
using ::strrchr;
inline _LIBCPP_INLINE_VISIBILITY const char* strrchr(const char* __s, int __c) {return ::strrchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
using ::strspn;
using ::strstr;
#ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY const char* strstr(const char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
#endif
using ::strtok;
using ::memset;

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -18,7 +18,7 @@ Macros:
NULL
CLOCKS_PER_SEC
namespace std
{

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -20,7 +20,7 @@ Macros:
WCHAR_MAX
WCHAR_MIN
WEOF
namespace std
{
@@ -49,7 +49,7 @@ wint_t fputwc(wchar_t c, FILE* stream);
int fputws(const wchar_t* restrict s, FILE* restrict stream);
int fwide(FILE* stream, int mode);
wint_t getwc(FILE* stream);
wint_t getwchar();
wint_t getwchar();
wint_t putwc(wchar_t c, FILE* stream);
wint_t putwchar(wchar_t c);
wint_t ungetwc(wint_t c, FILE* stream);
@@ -92,10 +92,10 @@ wint_t btowc(int c);
int wctob(wint_t c);
int mbsinit(const mbstate_t* ps);
size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
mbstate_t* restrict ps);
mbstate_t* restrict ps);
size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
mbstate_t* restrict ps);

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -17,7 +17,7 @@
Macros:
WEOF
namespace std
{
@@ -66,7 +66,7 @@ using ::wctype_t;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
#undef iswalnum
inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
#else // iswalnum
#else
using ::iswalnum;
#endif
@@ -74,7 +74,7 @@ using ::iswalnum;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
#undef iswalpha
inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
#else // iswalpha
#else
using ::iswalpha;
#endif
@@ -82,7 +82,7 @@ using ::iswalpha;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
#undef iswblank
inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
#else // iswblank
#else
using ::iswblank;
#endif
@@ -90,7 +90,7 @@ using ::iswblank;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
#undef iswcntrl
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
#else // iswcntrl
#else
using ::iswcntrl;
#endif
@@ -98,7 +98,7 @@ using ::iswcntrl;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
#undef iswdigit
inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
#else // iswdigit
#else
using ::iswdigit;
#endif
@@ -106,7 +106,7 @@ using ::iswdigit;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
#undef iswgraph
inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
#else // iswgraph
#else
using ::iswgraph;
#endif
@@ -114,7 +114,7 @@ using ::iswgraph;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
#undef iswlower
inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
#else // iswlower
#else
using ::iswlower;
#endif
@@ -122,7 +122,7 @@ using ::iswlower;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
#undef iswprint
inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
#else // iswprint
#else
using ::iswprint;
#endif
@@ -130,7 +130,7 @@ using ::iswprint;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
#undef iswpunct
inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
#else // iswpunct
#else
using ::iswpunct;
#endif
@@ -138,7 +138,7 @@ using ::iswpunct;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
#undef iswspace
inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
#else // iswspace
#else
using ::iswspace;
#endif
@@ -146,7 +146,7 @@ using ::iswspace;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
#undef iswupper
inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
#else // iswupper
#else
using ::iswupper;
#endif
@@ -154,7 +154,7 @@ using ::iswupper;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
#undef iswxdigit
inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
#else // iswxdigit
#else
using ::iswxdigit;
#endif
@@ -162,7 +162,7 @@ using ::iswxdigit;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
#undef iswctype
inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
#else // iswctype
#else
using ::iswctype;
#endif
@@ -170,7 +170,7 @@ using ::iswctype;
inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
#undef wctype
inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
#else // wctype
#else
using ::wctype;
#endif
@@ -178,7 +178,7 @@ using ::wctype;
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
#undef towlower
inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
#else // towlower
#else
using ::towlower;
#endif
@@ -186,7 +186,7 @@ using ::towlower;
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
#undef towupper
inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
#else // towupper
#else
using ::towupper;
#endif
@@ -194,7 +194,7 @@ using ::towupper;
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
#undef towctrans
inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
#else // towctrans
#else
using ::towctrans;
#endif
@@ -202,7 +202,7 @@ using ::towctrans;
inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
#undef wctrans
inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
#else // wctrans
#else
using ::wctrans;
#endif

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -159,7 +159,7 @@ template <class _Tp, class _Allocator> class __deque_base;
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class _LIBCPP_VISIBLE __deque_iterator;
class __deque_iterator;
template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -251,7 +251,7 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class _LIBCPP_VISIBLE __deque_iterator
class __deque_iterator
{
typedef _MapPointer __map_iterator;
public:
@@ -332,19 +332,19 @@ public:
}
return *this;
}
_LIBCPP_INLINE_VISIBILITY __deque_iterator& operator-=(difference_type __n)
{
return *this += -__n;
}
_LIBCPP_INLINE_VISIBILITY __deque_iterator operator+(difference_type __n) const
{
__deque_iterator __t(*this);
__t += __n;
return __t;
}
_LIBCPP_INLINE_VISIBILITY __deque_iterator operator-(difference_type __n) const
{
__deque_iterator __t(*this);
@@ -398,10 +398,11 @@ private:
_LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p)
: __m_iter_(__m), __ptr_(__p) {}
template <class _Tp, class _A> friend class __deque_base;
template <class _Tp, class _A> friend class _LIBCPP_VISIBLE deque;
template <class _Tp, class _A> friend class deque;
template <class _V, class _P, class _R, class _MP, class _D, _D>
friend class _LIBCPP_VISIBLE __deque_iterator;
friend class __deque_iterator;
template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -603,7 +604,7 @@ copy_backward(_RAIter __f,
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
while (__f != __l)
{
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _STD::prev(__r);
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = prev(__r);
pointer __rb = *__rp.__m_iter_;
pointer __re = __rp.__ptr_ + 1;
difference_type __bs = __re - __rb;
@@ -776,7 +777,7 @@ move_backward(_RAIter __f,
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
while (__f != __l)
{
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _STD::prev(__r);
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = prev(__r);
pointer __rb = *__rp.__m_iter_;
pointer __re = __rp.__ptr_ + 1;
difference_type __bs = __re - __rb;
@@ -930,18 +931,17 @@ protected:
explicit __deque_base(const allocator_type& __a);
~__deque_base();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
__deque_base(__deque_base&& __c);
__deque_base(__deque_base&& __c, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void swap(__deque_base& __c);
void clear();
bool __invariants() const;
_LIBCPP_INLINE_VISIBILITY
void __move_assign(__deque_base& __c)
{
__map_ = _STD::move(__c.__map_);
@@ -951,35 +951,28 @@ protected:
__c.__start_ = __c.size() = 0;
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__deque_base& __c)
{__move_assign_alloc(__c, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());}
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __deque_base& __c, true_type)
{
__alloc() = _STD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __deque_base& __c, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
{}
};
@@ -1067,7 +1060,7 @@ __deque_base<_Tp, _Allocator>::~__deque_base()
__alloc_traits::deallocate(__alloc(), *__i, __block_size);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Allocator>
__deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c)
@@ -1098,7 +1091,7 @@ __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Allocator>
void
@@ -1116,7 +1109,7 @@ __deque_base<_Tp, _Allocator>::clear()
{
allocator_type& __a = __alloc();
for (iterator __i = begin(), __e = end(); __i != __e; ++__i)
__alloc_traits::destroy(__a, _STD::addressof(*__i));
__alloc_traits::destroy(__a, addressof(*__i));
size() = 0;
while (__map_.size() > 2)
{
@@ -1135,12 +1128,12 @@ __deque_base<_Tp, _Allocator>::clear()
}
template <class _Tp, class _Allocator = allocator<_Tp> >
class _LIBCPP_VISIBLE deque
class deque
: private __deque_base<_Tp, _Allocator>
{
public:
// types:
typedef _Tp value_type;
typedef _Allocator allocator_type;
@@ -1177,14 +1170,13 @@ public:
deque(initializer_list<value_type> __il, const allocator_type& __a);
deque& operator=(const deque& __c);
_LIBCPP_INLINE_VISIBILITY
deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
deque(deque&& __c);
deque(deque&& __c, const allocator_type& __a);
deque& operator=(deque&& __c);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _InputIter>
void assign(_InputIter __f, _InputIter __l,
@@ -1194,48 +1186,34 @@ public:
void assign(_RAIter __f, _RAIter __l,
typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
void assign(size_type __n, const value_type& __v);
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
allocator_type get_allocator() const;
// iterators:
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __base::begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __base::begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __base::end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __base::end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(__base::end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(__base::end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(__base::begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(__base::begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return __base::begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __base::end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return const_reverse_iterator(__base::end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return const_reverse_iterator(__base::begin());}
// capacity:
_LIBCPP_INLINE_VISIBILITY size_type size() const {return __base::size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __alloc_traits::max_size(__base::__alloc());}
void resize(size_type __n);
void resize(size_type __n, const value_type& __v);
void shrink_to_fit();
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __base::size() == 0;}
bool empty() const {return __base::size() == 0;}
// element access:
reference operator[](size_type __i);
@@ -1250,16 +1228,14 @@ public:
// 23.2.2.3 modifiers:
void push_front(const value_type& __v);
void push_back(const value_type& __v);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class... _Args> void emplace_front(_Args&&... __args);
template <class... _Args> void emplace_back(_Args&&... __args);
template <class... _Args> iterator emplace(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
void push_front(value_type&& __v);
void push_back(value_type&& __v);
iterator insert(const_iterator __p, value_type&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
iterator insert(const_iterator __p, const value_type& __v);
iterator insert(const_iterator __p, size_type __n, const value_type& __v);
template <class _InputIter>
@@ -1269,7 +1245,6 @@ public:
template <class _BiIter>
iterator insert (const_iterator __p, _BiIter __f, _BiIter __l,
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, initializer_list<value_type> __il)
{return insert(__p, __il.begin(), __il.end());}
void pop_front();
@@ -1280,25 +1255,20 @@ public:
void swap(deque& __c);
void clear();
_LIBCPP_INLINE_VISIBILITY
bool __invariants() const {return __base::__invariants();}
private:
_LIBCPP_INLINE_VISIBILITY
static size_type __recommend_blocks(size_type __n)
{
return __n / __base::__block_size + (__n % __base::__block_size != 0);
}
_LIBCPP_INLINE_VISIBILITY
size_type __capacity() const
{
return __base::__map_.size() == 0 ? 0 : __base::__map_.size() * __base::__block_size - 1;
}
_LIBCPP_INLINE_VISIBILITY
size_type __front_spare() const
{
return __base::__start_;
}
_LIBCPP_INLINE_VISIBILITY
size_type __back_spare() const
{
return __capacity() - (__base::__start_ + __base::size());
@@ -1327,12 +1297,10 @@ private:
void __move_construct_backward_and_check(iterator __f, iterator __l,
iterator __r, const_pointer& __vt);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const deque& __c)
{__copy_assign_alloc(__c, integral_constant<bool,
__alloc_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const deque& __c, true_type)
{
if (__base::__alloc() != __c.__alloc())
@@ -1344,7 +1312,6 @@ private:
__base::__map_.__alloc() = __c.__map_.__alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const deque& __c, false_type)
{}
@@ -1430,17 +1397,17 @@ deque<_Tp, _Allocator>::operator=(const deque& __c)
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
deque<_Tp, _Allocator>::deque(deque&& __c)
: __base(_STD::move(__c))
{
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
: __base(_STD::move(__c), __a)
{
@@ -1452,7 +1419,7 @@ deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
deque<_Tp, _Allocator>&
deque<_Tp, _Allocator>::operator=(deque&& __c)
{
@@ -1483,7 +1450,7 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type)
__base::__move_assign(__c);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Allocator>
template <class _InputIter>
@@ -1533,7 +1500,7 @@ deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
_Allocator
deque<_Tp, _Allocator>::get_allocator() const
{
@@ -1592,7 +1559,7 @@ deque<_Tp, _Allocator>::shrink_to_fit()
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::operator[](size_type __i)
{
@@ -1601,7 +1568,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::operator[](size_type __i) const
{
@@ -1610,7 +1577,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i) const
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::at(size_type __i)
{
@@ -1621,7 +1588,7 @@ deque<_Tp, _Allocator>::at(size_type __i)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::at(size_type __i) const
{
@@ -1632,7 +1599,7 @@ deque<_Tp, _Allocator>::at(size_type __i) const
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::front()
{
@@ -1641,7 +1608,7 @@ deque<_Tp, _Allocator>::front()
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::front() const
{
@@ -1650,7 +1617,7 @@ deque<_Tp, _Allocator>::front() const
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::back()
{
@@ -1659,7 +1626,7 @@ deque<_Tp, _Allocator>::back()
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::back() const
{
@@ -1675,11 +1642,11 @@ deque<_Tp, _Allocator>::push_back(const value_type& __v)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), __v);
__alloc_traits::construct(__a, addressof(*__base::end()), __v);
++__base::size();
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Allocator>
void
@@ -1689,12 +1656,10 @@ deque<_Tp, _Allocator>::push_back(value_type&& __v)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::move(__v));
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::move(__v));
++__base::size();
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Allocator>
template <class... _Args>
void
@@ -1704,12 +1669,11 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::forward<_Args>(__args)...);
++__base::size();
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Allocator>
void
@@ -1719,12 +1683,12 @@ deque<_Tp, _Allocator>::push_front(const value_type& __v)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), __v);
__alloc_traits::construct(__a, addressof(*--__base::begin()), __v);
--__base::__start_;
++__base::size();
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Allocator>
void
@@ -1734,13 +1698,11 @@ deque<_Tp, _Allocator>::push_front(value_type&& __v)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::move(__v));
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::move(__v));
--__base::__start_;
++__base::size();
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Allocator>
template <class... _Args>
void
@@ -1750,13 +1712,12 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
--__base::__start_;
++__base::size();
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
@@ -1772,7 +1733,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), __v);
__alloc_traits::construct(__a, addressof(*--__base::begin()), __v);
--__base::__start_;
++__base::size();
}
@@ -1780,14 +1741,14 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
{
const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __b = __base::begin();
iterator __bm1 = _STD::prev(__b);
iterator __bm1 = prev(__b);
if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
__vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
__alloc_traits::construct(__a, addressof(*__bm1), _STD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = __move_and_check(_STD::next(__b), __b + __pos, __b, __vt);
__b = __move_and_check(next(__b), __b + __pos, __b, __vt);
*__b = *__vt;
}
}
@@ -1799,17 +1760,17 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), __v);
__alloc_traits::construct(__a, addressof(*__base::end()), __v);
++__base::size();
}
else
{
const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __e = __base::end();
iterator __em1 = _STD::prev(__e);
iterator __em1 = prev(__e);
if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
__vt = pointer_traits<const_pointer>::pointer_to(*__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
__alloc_traits::construct(__a, addressof(*__e), _STD::move(*__em1));
++__base::size();
if (__de > 1)
__e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
@@ -1819,7 +1780,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
return __base::begin() + __pos;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
@@ -1835,19 +1796,19 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::move(__v));
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::move(__v));
--__base::__start_;
++__base::size();
}
else
{
iterator __b = __base::begin();
iterator __bm1 = _STD::prev(__b);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
iterator __bm1 = prev(__b);
__alloc_traits::construct(__a, addressof(*__bm1), _STD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = _STD::move(_STD::next(__b), __b + __pos, __b);
__b = _STD::move(next(__b), __b + __pos, __b);
*__b = _STD::move(__v);
}
}
@@ -1859,14 +1820,14 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::move(__v));
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::move(__v));
++__base::size();
}
else
{
iterator __e = __base::end();
iterator __em1 = _STD::prev(__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
iterator __em1 = prev(__e);
__alloc_traits::construct(__a, addressof(*__e), _STD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _STD::move_backward(__e - __de, __em1, __e);
@@ -1876,8 +1837,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
return __base::begin() + __pos;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Allocator>
template <class... _Args>
typename deque<_Tp, _Allocator>::iterator
@@ -1893,19 +1852,19 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
--__base::__start_;
++__base::size();
}
else
{
iterator __b = __base::begin();
iterator __bm1 = _STD::prev(__b);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
iterator __bm1 = prev(__b);
__alloc_traits::construct(__a, addressof(*__bm1), _STD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = _STD::move(_STD::next(__b), __b + __pos, __b);
__b = _STD::move(next(__b), __b + __pos, __b);
*__b = value_type(_STD::forward<_Args>(__args)...);
}
}
@@ -1917,14 +1876,14 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::forward<_Args>(__args)...);
++__base::size();
}
else
{
iterator __e = __base::end();
iterator __em1 = _STD::prev(__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
iterator __em1 = prev(__e);
__alloc_traits::construct(__a, addressof(*__e), _STD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _STD::move_backward(__e - __de, __em1, __e);
@@ -1934,8 +1893,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
return __base::begin() + __pos;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
@@ -1955,7 +1913,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __pos)
{
for (size_type __m = __n - __pos; __m; --__m, --__base::__start_, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*--__i), __v);
__alloc_traits::construct(__a, addressof(*--__i), __v);
__n = __pos;
}
if (__n > 0)
@@ -1981,7 +1939,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __de)
{
for (size_type __m = __n - __de; __m; --__m, ++__i, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), __v);
__alloc_traits::construct(__a, addressof(*__i), __v);
__n = __de;
}
if (__n > 0)
@@ -2033,7 +1991,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
{
__m = __pos < __n / 2 ? _STD::prev(__l, __pos) : _STD::next(__f, __n - __pos);
for (_BiIter __j = __m; __j != __f; --__base::__start_, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*--__i), *--__j);
__alloc_traits::construct(__a, addressof(*--__i), *--__j);
__n = __pos;
}
if (__n > 0)
@@ -2041,7 +1999,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
iterator __obn = __old_begin + __n;
for (iterator __j = __obn; __j != __old_begin;)
{
__alloc_traits::construct(__a, _STD::addressof(*--__i), _STD::move(*--__j));
__alloc_traits::construct(__a, addressof(*--__i), _STD::move(*--__j));
--__base::__start_;
++__base::size();
}
@@ -2065,14 +2023,14 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
{
__m = __de < __n / 2 ? _STD::next(__f, __de) : _STD::prev(__l, __n - __de);
for (_BiIter __j = __m; __j != __l; ++__i, ++__j, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), *__j);
__alloc_traits::construct(__a, addressof(*__i), *__j);
__n = __de;
}
if (__n > 0)
{
iterator __oen = __old_end - __n;
for (iterator __j = __oen; __j != __old_end; ++__i, ++__j, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), _STD::move(*__j));
__alloc_traits::construct(__a, addressof(*__i), _STD::move(*__j));
if (__n < __de)
__old_end = _STD::move_backward(__old_end - __de, __oen, __old_end);
_STD::copy_backward(__f, __m, __old_end);
@@ -2105,7 +2063,7 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
for (iterator __i = __base::end(); __f != __l; ++__i, ++__f, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), *__f);
__alloc_traits::construct(__a, addressof(*__i), *__f);
}
template <class _Tp, class _Allocator>
@@ -2118,7 +2076,7 @@ deque<_Tp, _Allocator>::__append(size_type __n)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i));
__alloc_traits::construct(__a, addressof(*__i));
}
template <class _Tp, class _Allocator>
@@ -2131,7 +2089,7 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), __v);
__alloc_traits::construct(__a, addressof(*__i), __v);
}
// Create front capacity for one block of elements.
@@ -2176,7 +2134,7 @@ deque<_Tp, _Allocator>::__add_front_capacity()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -2185,7 +2143,7 @@ deque<_Tp, _Allocator>::__add_front_capacity()
__alloc_traits::deallocate(__a, __buf.front(), __base::__block_size);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (typename __base::__map_pointer __i = __base::__map_.begin();
__i != __base::__map_.end(); ++__i)
__buf.push_back(*__i);
@@ -2209,7 +2167,7 @@ deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
size_type __nb = __recommend_blocks(__n + __base::__map_.empty());
// Number of unused blocks at back:
size_type __back_capacity = __back_spare() / __base::__block_size;
__back_capacity = _STD::min(__back_capacity, __nb); // don't take more than you need
__back_capacity = min(__back_capacity, __nb); // don't take more than you need
__nb -= __back_capacity; // number of blocks need to allocate
// If __nb == 0, then we have sufficient capacity.
if (__nb == 0)
@@ -2255,7 +2213,7 @@ deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (; __nb > 0; --__nb)
__buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -2267,7 +2225,7 @@ deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
__alloc_traits::deallocate(__a, *__i, __base::__block_size);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (; __back_capacity > 0; --__back_capacity)
{
__buf.push_back(__base::__map_.back());
@@ -2324,7 +2282,7 @@ deque<_Tp, _Allocator>::__add_back_capacity()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -2333,7 +2291,7 @@ deque<_Tp, _Allocator>::__add_back_capacity()
__alloc_traits::deallocate(__a, __buf.back(), __base::__block_size);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (typename __base::__map_pointer __i = __base::__map_.end();
__i != __base::__map_.begin();)
__buf.push_front(*--__i);
@@ -2354,7 +2312,7 @@ deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
size_type __nb = __recommend_blocks(__n + __base::__map_.empty());
// Number of unused blocks at front:
size_type __front_capacity = __front_spare() / __base::__block_size;
__front_capacity = _STD::min(__front_capacity, __nb); // don't take more than you need
__front_capacity = min(__front_capacity, __nb); // don't take more than you need
__nb -= __front_capacity; // number of blocks need to allocate
// If __nb == 0, then we have sufficient capacity.
if (__nb == 0)
@@ -2402,7 +2360,7 @@ deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (; __nb > 0; --__nb)
__buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -2414,7 +2372,7 @@ deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
__alloc_traits::deallocate(__a, *__i, __base::__block_size);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (; __front_capacity > 0; --__front_capacity)
{
__buf.push_back(__base::__map_.front());
@@ -2536,7 +2494,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
allocator_type& __a = __base::__alloc();
// as if
// for (; __f != __l; ++__r, ++__f, ++__base::size())
// __alloc_traits::construct(__a, _STD::addressof(*__r), _STD::move(*__f));
// __alloc_traits::construct(__a, addressof(*__r), _STD::move(*__f));
difference_type __n = __l - __f;
while (__n > 0)
{
@@ -2551,7 +2509,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
if (__fb <= __vt && __vt < __fe)
__vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__r), _STD::move(*__fb));
__alloc_traits::construct(__a, addressof(*__r), _STD::move(*__fb));
__n -= __bs;
__f += __bs;
}
@@ -2568,7 +2526,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
// as if
// for (iterator __j = __l; __j != __f;)
// {
// __alloc_traitsconstruct(__a, _STD::addressof(*--__r), _STD::move(*--__j));
// __alloc_traitsconstruct(__a, addressof(*--__r), _STD::move(*--__j));
// --__base::__start_;
// ++__base::size();
// }
@@ -2588,7 +2546,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
__vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
while (__le != __lb)
{
__alloc_traits::construct(__a, _STD::addressof(*--__r), _STD::move(*--__le));
__alloc_traits::construct(__a, addressof(*--__r), _STD::move(*--__le));
--__base::__start_;
++__base::size();
}
@@ -2608,8 +2566,8 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
allocator_type& __a = __base::__alloc();
if (__pos < (__base::size() - 1) / 2)
{ // erase from front
_STD::move_backward(__b, __p, _STD::next(__p));
__alloc_traits::destroy(__a, _STD::addressof(*__b));
_STD::move_backward(__b, __p, next(__p));
__alloc_traits::destroy(__a, addressof(*__b));
--__base::size();
++__base::__start_;
if (__front_spare() >= 2 * __base::__block_size)
@@ -2621,8 +2579,8 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
}
else
{ // erase from back
iterator __i = _STD::move(_STD::next(__p), __base::end(), __p);
__alloc_traits::destroy(__a, _STD::addressof(*__i));
iterator __i = _STD::move(next(__p), __base::end(), __p);
__alloc_traits::destroy(__a, addressof(*__i));
--__base::size();
if (__back_spare() >= 2 * __base::__block_size)
{
@@ -2648,7 +2606,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
{ // erase from front
iterator __i = _STD::move_backward(__b, __p, __p + __n);
for (; __b != __i; ++__b)
__alloc_traits::destroy(__a, _STD::addressof(*__b));
__alloc_traits::destroy(__a, addressof(*__b));
__base::size() -= __n;
__base::__start_ += __n;
while (__front_spare() >= 2 * __base::__block_size)
@@ -2662,7 +2620,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
{ // erase from back
iterator __i = _STD::move(__p + __n, __base::end(), __p);
for (iterator __e = __base::end(); __i != __e; ++__i)
__alloc_traits::destroy(__a, _STD::addressof(*__i));
__alloc_traits::destroy(__a, addressof(*__i));
__base::size() -= __n;
while (__back_spare() >= 2 * __base::__block_size)
{
@@ -2686,7 +2644,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
iterator __b = __base::begin();
difference_type __pos = __f - __b;
for (iterator __p = __b + __pos; __p != __e; ++__p)
__alloc_traits::destroy(__a, _STD::addressof(*__p));
__alloc_traits::destroy(__a, addressof(*__p));
__base::size() -= __n;
while (__back_spare() >= 2 * __base::__block_size)
{
@@ -2697,7 +2655,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
deque<_Tp, _Allocator>::swap(deque& __c)
{
@@ -2705,7 +2663,7 @@ deque<_Tp, _Allocator>::swap(deque& __c)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
deque<_Tp, _Allocator>::clear()
{

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -40,12 +40,10 @@ public:
typedef void (*unexpected_handler)();
unexpected_handler set_unexpected(unexpected_handler f ) throw();
unexpected_handler get_unexpected() throw();
void unexpected [[noreturn]] ();
typedef void (*terminate_handler)();
terminate_handler set_terminate(terminate_handler f ) throw();
terminate_handler get_terminate() throw();
void terminate [[noreturn]] ();
bool uncaught_exception() throw();
@@ -104,12 +102,10 @@ public:
typedef void (*unexpected_handler)();
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) throw();
_LIBCPP_VISIBLE unexpected_handler get_unexpected() throw();
_LIBCPP_VISIBLE void unexpected();
typedef void (*terminate_handler)();
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) throw();
_LIBCPP_VISIBLE terminate_handler get_terminate() throw();
_LIBCPP_VISIBLE void terminate() __attribute__((__noreturn__));
_LIBCPP_VISIBLE bool uncaught_exception() throw();
@@ -119,25 +115,22 @@ class exception_ptr;
exception_ptr current_exception();
void rethrow_exception(exception_ptr); // noreturn
class _LIBCPP_VISIBLE exception_ptr
class exception_ptr
{
void* __ptr_;
public:
_LIBCPP_INLINE_VISIBILITY exception_ptr() : __ptr_() {}
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) : __ptr_() {}
exception_ptr() : __ptr_() {}
exception_ptr(nullptr_t) : __ptr_() {}
exception_ptr(const exception_ptr&);
exception_ptr& operator=(const exception_ptr&);
~exception_ptr();
_LIBCPP_INLINE_VISIBILITY
// explicit
operator bool() const {return __ptr_ != nullptr;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const exception_ptr& __x, const exception_ptr& __y)
friend bool operator==(const exception_ptr& __x, const exception_ptr& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const exception_ptr& __x, const exception_ptr& __y)
friend bool operator!=(const exception_ptr& __x, const exception_ptr& __y)
{return !(__x == __y);}
friend exception_ptr current_exception();
@@ -148,7 +141,6 @@ template<class _E>
exception_ptr
make_exception_ptr(_E __e)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
throw __e;
@@ -157,7 +149,6 @@ make_exception_ptr(_E __e)
{
return current_exception();
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
// nested_exception
@@ -173,7 +164,7 @@ public:
// access functions
void rethrow_nested /*[[noreturn]]*/ () const;
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const {return __ptr_;}
exception_ptr nested_ptr() const {return __ptr_;}
};
template <class _Tp>
@@ -181,47 +172,43 @@ struct __nested
: public _Tp,
public nested_exception
{
_LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
explicit __nested(const _Tp& __t) : _Tp(__t) {}
};
template <class _Tp>
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void
#ifdef _LIBCPP_MOVE
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
is_class<typename remove_reference<_Tp>::type>::value &&
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
>::type* = 0)
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
throw_with_nested (_Tp& __t, typename enable_if<
is_class<_Tp>::value && !is_base_of<nested_exception, _Tp>::value
>::type* = 0)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw __nested<typename remove_reference<_Tp>::type>(_STD::forward<_Tp>(__t));
#endif
{
throw __nested<typename remove_reference<_Tp>::type>(_STD::forward<_Tp>(__t));
}
template <class _Tp>
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void
#ifdef _LIBCPP_MOVE
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
!is_class<typename remove_reference<_Tp>::type>::value ||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
>::type* = 0)
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
throw_with_nested (_Tp& __t, typename enable_if<
!is_class<_Tp>::value || is_base_of<nested_exception, _Tp>::value
>::type* = 0)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw _STD::forward<_Tp>(__t);
#endif
{
throw _STD::forward<_Tp>(__t);
}
template <class _E>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
rethrow_if_nested(const _E& __e, typename enable_if<
is_polymorphic<_E>::value
@@ -233,7 +220,7 @@ rethrow_if_nested(const _E& __e, typename enable_if<
}
template <class _E>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
rethrow_if_nested(const _E& __e, typename enable_if<
!is_polymorphic<_E>::value

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -217,13 +217,11 @@ class __hash_map_hasher
: private _Hash
{
public:
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : _Hash() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_hasher() : _Hash() {}
__hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
const _Hash& hash_function() const {return *this;}
size_t operator()(const _Tp& __x) const
{return static_cast<const _Hash&>(*this)(__x.first);}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const typename _Tp::first_type& __x) const
{return static_cast<const _Hash&>(*this)(__x);}
};
@@ -233,13 +231,11 @@ class __hash_map_hasher<_Tp, _Hash, false>
{
_Hash __hash_;
public:
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : __hash_() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return __hash_;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_hasher() : __hash_() {}
__hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
const _Hash& hash_function() const {return __hash_;}
size_t operator()(const _Tp& __x) const
{return __hash_(__x.first);}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const typename _Tp::first_type& __x) const
{return __hash_(__x);}
};
@@ -249,20 +245,16 @@ class __hash_map_equal
: private _Pred
{
public:
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : _Pred() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_equal() : _Pred() {}
__hash_map_equal(const _Pred& __p) : _Pred(__p) {}
const _Pred& key_eq() const {return *this;}
bool operator()(const _Tp& __x, const _Tp& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x,
bool operator()(const typename _Tp::first_type& __x,
const typename _Tp::first_type& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y);}
};
@@ -272,19 +264,15 @@ class __hash_map_equal<_Tp, _Pred, false>
{
_Pred __pred_;
public:
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : __pred_() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return __pred_;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_equal() : __pred_() {}
__hash_map_equal(const _Pred& __p) : __pred_(__p) {}
const _Pred& key_eq() const {return __pred_;}
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __pred_(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
{return __pred_(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
{return __pred_(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x,
const typename _Tp::first_type& __y) const
{return __pred_(__x, __y);}
@@ -310,15 +298,13 @@ public:
bool __first_constructed;
bool __second_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_map_node_destructor(allocator_type& __na)
: __na_(__na),
__first_constructed(false),
__second_constructed(false)
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -326,8 +312,7 @@ public:
{
__x.__value_constructed = false;
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#else
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -335,22 +320,21 @@ public:
{
const_cast<bool&>(__x.__value_constructed) = false;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__second_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
};
template <class _HashIterator>
class _LIBCPP_VISIBLE __hash_map_iterator
class __hash_map_iterator
{
_HashIterator __i_;
@@ -370,15 +354,14 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
__hash_map_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
__hash_map_iterator(_HashIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return (pointer)__i_.operator->();}
reference operator*() const {return *operator->();}
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator& operator++() {++__i_; return *this;}
__hash_map_iterator operator++(int)
{
__hash_map_iterator __t(*this);
@@ -386,22 +369,20 @@ public:
return __t;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
friend bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
friend bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
template <class, class, class, class, class> friend class hash_map;
template <class, class, class, class, class> friend class hash_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_const_local_iterator;
template <class> friend class __hash_map_const_iterator;
};
template <class _HashIterator>
class _LIBCPP_VISIBLE __hash_map_const_iterator
class __hash_map_const_iterator
{
_HashIterator __i_;
@@ -421,23 +402,17 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
__hash_map_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator(
__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
: __i_(__i.__i_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator operator++(int)
{
__hash_map_const_iterator __t(*this);
@@ -445,22 +420,20 @@ public:
return __t;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
friend bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
friend bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class, class, class, class, class> friend class hash_map;
template <class, class, class, class, class> friend class hash_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_const_local_iterator;
};
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_VISIBLE hash_map
class hash_map
{
public:
// types
@@ -507,7 +480,7 @@ public:
typedef __hash_map_iterator<typename __table::iterator> iterator;
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
_LIBCPP_INLINE_VISIBILITY hash_map() {__table_.rehash(193);}
hash_map() {__table_.rehash(193);}
explicit hash_map(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
hash_map(size_type __n, const hasher& __hf,
@@ -526,77 +499,52 @@ public:
const allocator_type& __a);
hash_map(const hash_map& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first.__i_, __last.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_map& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const
{return __table_.hash_function().hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const
{return __table_.key_eq().key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
mapped_type& operator[](const key_type& __k);
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const
{return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
private:
@@ -666,16 +614,16 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__node_traits::construct(__na, addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _STD::move(__h);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -698,7 +646,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -726,7 +674,7 @@ operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -736,7 +684,7 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_VISIBLE hash_multimap
class hash_multimap
{
public:
// types
@@ -781,7 +729,6 @@ public:
typedef __hash_map_iterator<typename __table::iterator> iterator;
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
_LIBCPP_INLINE_VISIBILITY
hash_multimap() {__table_.rehash(193);}
explicit hash_multimap(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -801,74 +748,49 @@ public:
const allocator_type& __a);
hash_multimap(const hash_multimap& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first.__i_, __last.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_multimap& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const
{return __table_.hash_function().hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const
{return __table_.key_eq().key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const
{return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
};
@@ -931,7 +853,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -941,7 +863,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -973,7 +895,7 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -205,7 +205,7 @@ using namespace std;
template <class _Value, class _Hash = std::hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_VISIBLE hash_set
class hash_set
{
public:
// types
@@ -231,7 +231,6 @@ public:
typedef typename __table::const_iterator iterator;
typedef typename __table::const_iterator const_iterator;
_LIBCPP_INLINE_VISIBILITY
hash_set() {__table_.rehash(193);}
explicit hash_set(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -249,72 +248,47 @@ public:
const allocator_type& __a);
hash_set(const hash_set& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_set& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const {return __table_.hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const {return __table_.key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
};
@@ -376,7 +350,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -386,7 +360,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -414,7 +388,7 @@ operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -424,7 +398,7 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_VISIBLE hash_multiset
class hash_multiset
{
public:
// types
@@ -450,7 +424,6 @@ public:
typedef typename __table::const_iterator iterator;
typedef typename __table::const_iterator const_iterator;
_LIBCPP_INLINE_VISIBILITY
hash_multiset() {__table_.rehash(193);}
explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -468,71 +441,46 @@ public:
const key_equal& __eql, const allocator_type& __a);
hash_multiset(const hash_multiset& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_multiset& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const {return __table_.hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const {return __table_.key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
};
@@ -595,7 +543,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -605,7 +553,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -637,7 +585,7 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -97,8 +97,8 @@ public:
InputIterator first, InputIterator last);
iterator insert_after(const_iterator p, initializer_list<value_type> il);
iterator erase_after(const_iterator p);
iterator erase_after(const_iterator first, const_iterator last);
void erase_after(const_iterator p);
void erase_after(const_iterator first, const_iterator last);
void swap(forward_list& x);
@@ -106,21 +106,15 @@ public:
void resize(size_type n, const value_type& v);
void clear();
void splice_after(const_iterator p, forward_list& x);
void splice_after(const_iterator p, forward_list&& x);
void splice_after(const_iterator p, forward_list& x, const_iterator i);
void splice_after(const_iterator p, forward_list&& x, const_iterator i);
void splice_after(const_iterator p, forward_list& x,
const_iterator first, const_iterator last);
void splice_after(const_iterator p, forward_list&& x,
const_iterator first, const_iterator last);
void remove(const value_type& v);
template <class Predicate> void remove_if(Predicate pred);
void unique();
template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);
void merge(forward_list& x);
void merge(forward_list&& x);
template <class Compare> void merge(forward_list& x, Compare comp);
template <class Compare> void merge(forward_list&& x, Compare comp);
void sort();
template <class Compare> void sort(Compare comp);
@@ -180,7 +174,7 @@ struct __forward_begin_node
pointer __next_;
_LIBCPP_INLINE_VISIBILITY __forward_begin_node() : __next_(nullptr) {}
__forward_begin_node() : __next_(nullptr) {}
};
template <class _Tp, class _VoidPtr>
@@ -204,13 +198,12 @@ template<class, class> class forward_list;
template<class> class __forward_list_const_iterator;
template <class _NodePtr>
class _LIBCPP_VISIBLE __forward_list_iterator
class __forward_list_iterator
{
typedef _NodePtr __node_pointer;
__node_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY
explicit __forward_list_iterator(__node_pointer __p) : __ptr_(__p) {}
template<class, class> friend class forward_list;
@@ -221,7 +214,7 @@ public:
typedef typename pointer_traits<__node_pointer>::element_type::value_type
value_type;
typedef value_type& reference;
typedef typename pointer_traits<__node_pointer>::difference_type
typedef typename pointer_traits<__node_pointer>::difference_type
difference_type;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -231,21 +224,16 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__forward_list_iterator() : __ptr_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__forward_list_iterator& operator++()
{
__ptr_ = __ptr_->__next_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__forward_list_iterator operator++(int)
{
__forward_list_iterator __t(*this);
@@ -253,24 +241,21 @@ public:
return __t;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __forward_list_iterator& __x,
const __forward_list_iterator& __y)
friend bool operator==(const __forward_list_iterator& __x,
const __forward_list_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __forward_list_iterator& __x,
const __forward_list_iterator& __y)
friend bool operator!=(const __forward_list_iterator& __x,
const __forward_list_iterator& __y)
{return !(__x == __y);}
};
template <class _NodeConstPtr>
class _LIBCPP_VISIBLE __forward_list_const_iterator
class __forward_list_const_iterator
{
typedef _NodeConstPtr __node_const_pointer;
__node_const_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY
explicit __forward_list_const_iterator(__node_const_pointer __p)
: __ptr_(__p) {}
@@ -292,7 +277,7 @@ public:
typedef forward_iterator_tag iterator_category;
typedef typename __node::value_type value_type;
typedef const value_type& reference;
typedef typename pointer_traits<__node_const_pointer>::difference_type
typedef typename pointer_traits<__node_const_pointer>::difference_type
difference_type;
typedef typename pointer_traits<__node_const_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -302,24 +287,18 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator() : __ptr_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p)
: __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator& operator++()
{
__ptr_ = __ptr_->__next_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator operator++(int)
{
__forward_list_const_iterator __t(*this);
@@ -327,12 +306,10 @@ public:
return __t;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __forward_list_const_iterator& __x,
const __forward_list_const_iterator& __y)
friend bool operator==(const __forward_list_const_iterator& __x,
const __forward_list_const_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __forward_list_const_iterator& __x,
friend bool operator!=(const __forward_list_const_iterator& __x,
const __forward_list_const_iterator& __y)
{return !(__x == __y);}
};
@@ -360,34 +337,28 @@ protected:
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
_LIBCPP_INLINE_VISIBILITY
__node_pointer __before_begin()
{return pointer_traits<__node_pointer>::pointer_to(
static_cast<__node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY
__node_const_pointer __before_begin() const
{return pointer_traits<__node_const_pointer>::pointer_to(
static_cast<const __node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY
__node_allocator& __alloc() {return __before_begin_.second();}
_LIBCPP_INLINE_VISIBILITY
const __node_allocator& __alloc() const {return __before_begin_.second();}
typedef __forward_list_iterator<__node_pointer> iterator;
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
_LIBCPP_INLINE_VISIBILITY
__forward_list_base()
: __before_begin_(__begin_node()) {}
_LIBCPP_INLINE_VISIBILITY
__forward_list_base(const allocator_type& __a)
: __before_begin_(__begin_node(), __node_allocator(__a)) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
__forward_list_base(__forward_list_base&& __x);
__forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
private:
__forward_list_base(const __forward_list_base&);
@@ -396,12 +367,10 @@ protected:
~__forward_list_base();
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __forward_list_base& __x)
{__copy_assign_alloc(__x, integral_constant<bool,
__node_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x)
{__move_assign_alloc(__x, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());}
@@ -410,9 +379,7 @@ protected:
void clear();
private:
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __forward_list_base&, false_type) {}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __forward_list_base& __x, true_type)
{
if (__alloc() != __x.__alloc())
@@ -420,21 +387,16 @@ private:
__alloc() = __x.__alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x, false_type) {}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x, true_type)
{__alloc() = _STD::move(__x.__alloc());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__node_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
false_type)
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
true_type)
{
@@ -443,10 +405,10 @@ private:
}
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
: __before_begin_(_STD::move(__x.__before_begin_))
{
@@ -454,7 +416,7 @@ __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x,
const allocator_type& __a)
: __before_begin_(__begin_node(), __node_allocator(__a))
@@ -466,7 +428,7 @@ __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x,
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Alloc>
__forward_list_base<_Tp, _Alloc>::~__forward_list_base()
@@ -475,7 +437,7 @@ __forward_list_base<_Tp, _Alloc>::~__forward_list_base()
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
{
@@ -492,7 +454,7 @@ __forward_list_base<_Tp, _Alloc>::clear()
for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
{
__node_pointer __next = __p->__next_;
__node_traits::destroy(__a, _STD::addressof(__p->__value_));
__node_traits::destroy(__a, addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1);
__p = __next;
}
@@ -500,7 +462,7 @@ __forward_list_base<_Tp, _Alloc>::clear()
}
template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_VISIBLE forward_list
class forward_list
: private __forward_list_base<_Tp, _Alloc>
{
typedef __forward_list_base<_Tp, _Alloc> base;
@@ -518,7 +480,7 @@ public:
typedef typename base::iterator iterator;
typedef typename base::const_iterator const_iterator;
_LIBCPP_INLINE_VISIBILITY forward_list() {} // = default;
forward_list() {} // = default;
explicit forward_list(const allocator_type& __a);
explicit forward_list(size_type __n);
forward_list(size_type __n, const value_type& __v);
@@ -536,18 +498,17 @@ public:
>::type* = nullptr);
forward_list(const forward_list& __x);
forward_list(const forward_list& __x, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
forward_list(forward_list&& __x) : base(_STD::move(__x)) {}
forward_list(forward_list&& __x, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
forward_list(initializer_list<value_type> __il);
forward_list(initializer_list<value_type> __il, const allocator_type& __a);
// ~forward_list() = default;
forward_list& operator=(const forward_list& __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
forward_list& operator=(forward_list&& __x);
#endif
forward_list& operator=(initializer_list<value_type> __il);
@@ -562,61 +523,42 @@ public:
void assign(size_type __n, const value_type& __v);
void assign(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return allocator_type(base::__alloc());}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return const_iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return const_iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return const_iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return const_iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY
iterator before_begin() {return iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator before_begin() const {return const_iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbefore_begin() const {return const_iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return base::__before_begin()->__next_ == nullptr;}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return numeric_limits<size_type>::max();}
_LIBCPP_INLINE_VISIBILITY
reference front() {return base::__before_begin()->__next_->__value_;}
_LIBCPP_INLINE_VISIBILITY
const_reference front() const {return base::__before_begin()->__next_->__value_;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class... _Args> void emplace_front(_Args&&... __args);
#endif
void push_front(value_type&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void push_front(const value_type& __v);
void pop_front();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class... _Args>
iterator emplace_after(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
iterator insert_after(const_iterator __p, value_type&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
iterator insert_after(const_iterator __p, const value_type& __v);
iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
__is_input_iterator<_InputIterator>::value,
@@ -626,47 +568,37 @@ public:
iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
{return insert_after(__p, __il.begin(), __il.end());}
iterator erase_after(const_iterator __p);
iterator erase_after(const_iterator __f, const_iterator __l);
void erase_after(const_iterator __p);
void erase_after(const_iterator __f, const_iterator __l);
_LIBCPP_INLINE_VISIBILITY
void swap(forward_list& __x) {base::swap(__x);}
void resize(size_type __n);
void resize(size_type __n, const value_type& __v);
_LIBCPP_INLINE_VISIBILITY
void clear() {base::clear();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
void splice_after(const_iterator __p, forward_list&& __x);
_LIBCPP_INLINE_VISIBILITY
void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
_LIBCPP_INLINE_VISIBILITY
void splice_after(const_iterator __p, forward_list&& __x,
const_iterator __f, const_iterator __l);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
void splice_after(const_iterator __p, forward_list& __x);
void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
void splice_after(const_iterator __p, forward_list& __x,
const_iterator __f, const_iterator __l);
#endif
void remove(const value_type& __v);
template <class _Predicate> void remove_if(_Predicate __pred);
_LIBCPP_INLINE_VISIBILITY
void unique() {unique(__equal_to<value_type>());}
template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
template <class _Compare>
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x, _Compare __comp)
{merge(__x, _STD::move(__comp));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
void merge(forward_list&& __x) {merge(_STD::move(__x), __less<value_type>());}
template <class _Compare> void merge(forward_list&& __x, _Compare __comp);
#else
void merge(forward_list& __x) {merge(__x, __less<value_type>());}
template <class _Compare> void merge(forward_list& __x, _Compare __comp);
_LIBCPP_INLINE_VISIBILITY
#endif
void sort() {sort(__less<value_type>());}
template <class _Compare> void sort(_Compare __comp);
void reverse();
@@ -677,10 +609,10 @@ private:
typedef typename base::__node_traits __node_traits;
typedef typename base::__node_pointer __node_pointer;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
void __move_assign(forward_list& __x, true_type);
void __move_assign(forward_list& __x, false_type);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Compare>
static
@@ -694,7 +626,7 @@ private:
};
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a)
: base(__a)
{
@@ -712,7 +644,7 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
__p = __p->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_));
__node_traits::construct(__a, addressof(__h->__value_));
__h->__next_ = nullptr;
__p->__next_ = __h.release();
}
@@ -773,7 +705,7 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
insert_after(cbefore_begin(), __x.begin(), __x.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
@@ -787,7 +719,7 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
@@ -815,7 +747,7 @@ forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Alloc>
void
@@ -841,7 +773,7 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
{
@@ -850,10 +782,10 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
{
@@ -871,7 +803,7 @@ typename enable_if
forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
{
iterator __i = before_begin();
iterator __j = _STD::next(__i);
iterator __j = next(__i);
iterator __e = end();
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
*__j = *__f;
@@ -886,7 +818,7 @@ void
forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
{
iterator __i = before_begin();
iterator __j = _STD::next(__i);
iterator __j = next(__i);
iterator __e = end();
for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
*__j = __v;
@@ -897,15 +829,14 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
{
assign(__il.begin(), __il.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Alloc>
template <class... _Args>
@@ -915,14 +846,12 @@ forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_),
__node_traits::construct(__a, addressof(__h->__value_),
_STD::forward<_Args>(__args)...);
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
}
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
@@ -930,12 +859,12 @@ forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v));
__node_traits::construct(__a, addressof(__h->__value_), _STD::move(__v));
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Alloc>
void
@@ -944,7 +873,7 @@ forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, addressof(__h->__value_), __v);
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
}
@@ -956,12 +885,11 @@ forward_list<_Tp, _Alloc>::pop_front()
__node_allocator& __a = base::__alloc();
__node_pointer __p = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __p->__next_;
__node_traits::destroy(__a, _STD::addressof(__p->__value_));
__node_traits::destroy(__a, addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Alloc>
template <class... _Args>
@@ -972,15 +900,13 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_),
__node_traits::construct(__a, addressof(__h->__value_),
_STD::forward<_Args>(__args)...);
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
return iterator(__r->__next_);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
@@ -989,13 +915,13 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v));
__node_traits::construct(__a, addressof(__h->__value_), _STD::move(__v));
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
return iterator(__r->__next_);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
@@ -1005,7 +931,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, addressof(__h->__value_), __v);
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
return iterator(__r->__next_);
@@ -1016,23 +942,23 @@ typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
const value_type& __v)
{
__node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, addressof(__h->__value_), __v);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (--__n; __n != 0; --__n, __last = __last->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, addressof(__h->__value_), __v);
__last->__next_ = __h.release();
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1042,16 +968,15 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
while (__first != nullptr)
{
__node_pointer __next = __first->__next_;
__node_traits::destroy(__a, _STD::addressof(__first->__value_));
__node_traits::destroy(__a, addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1);
__first = __next;
}
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__last->__next_ = __r->__next_;
__r->__next_ = __first;
__r = __last;
}
return iterator(__r);
}
@@ -1066,23 +991,23 @@ typename enable_if
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
_InputIterator __f, _InputIterator __l)
{
__node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
if (__f != __l)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), *__f);
__node_traits::construct(__a, addressof(__h->__value_), *__f);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (++__f; __f != __l; ++__f, __last = __last->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), *__f);
__node_traits::construct(__a, addressof(__h->__value_), *__f);
__last->__next_ = __h.release();
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1092,42 +1017,40 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
while (__first != nullptr)
{
__node_pointer __next = __first->__next_;
__node_traits::destroy(__a, _STD::addressof(__first->__value_));
__node_traits::destroy(__a, addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1);
__first = __next;
}
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__last->__next_ = __r->__next_;
__r->__next_ = __first;
__r = __last;
}
return iterator(__r);
}
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
void
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
{
__node_pointer __p = const_cast<__node_pointer>(__f.__ptr_);
__node_pointer __n = __p->__next_;
__p->__next_ = __n->__next_;
__node_allocator& __a = base::__alloc();
__node_traits::destroy(__a, _STD::addressof(__n->__value_));
__node_traits::destroy(__a, addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1);
return iterator(__p->__next_);
}
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
void
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
{
__node_pointer __e = const_cast<__node_pointer>(__l.__ptr_);
if (__f != __l)
{
__node_pointer __p = const_cast<__node_pointer>(__f.__ptr_);
__node_pointer __n = __p->__next_;
__node_pointer __e = const_cast<__node_pointer>(__l.__ptr_);
if (__n != __e)
{
__p->__next_ = __e;
@@ -1135,13 +1058,12 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
do
{
__p = __n->__next_;
__node_traits::destroy(__a, _STD::addressof(__n->__value_));
__node_traits::destroy(__a, addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1);
__n = __p;
} while (__n != __e);
}
}
return iterator(__e);
}
template <class _Tp, class _Alloc>
@@ -1168,7 +1090,7 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
__ptr = __ptr->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_));
__node_traits::construct(__a, addressof(__h->__value_));
__h->__next_ = nullptr;
__ptr->__next_ = __h.release();
}
@@ -1200,7 +1122,7 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
__ptr = __ptr->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, addressof(__h->__value_), __v);
__h->__next_ = nullptr;
__ptr->__next_ = __h.release();
}
@@ -1211,7 +1133,11 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
#ifdef _LIBCPP_MOVE
forward_list&& __x)
#else
forward_list& __x)
#endif
{
if (!__x.empty())
{
@@ -1232,10 +1158,14 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
#ifdef _LIBCPP_MOVE
forward_list&& __x,
#else
forward_list& __x,
#endif
const_iterator __i)
{
const_iterator __lm1 = _STD::next(__i);
const_iterator __lm1 = next(__i);
if (__p != __i && __p != __lm1)
{
const_cast<__node_pointer>(__i.__ptr_)->__next_ =
@@ -1250,7 +1180,11 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
#ifdef _LIBCPP_MOVE
forward_list&& __x,
#else
forward_list& __x,
#endif
const_iterator __f, const_iterator __l)
{
if (__f != __l && __p != __f)
@@ -1270,39 +1204,6 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
}
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list&& __x)
{
splice_after(__p, __x);
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list&& __x,
const_iterator __i)
{
splice_after(__p, __x, __i);
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list&& __x,
const_iterator __f, const_iterator __l)
{
splice_after(__p, __x, __f, __l);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::remove(const value_type& __v)
@@ -1312,7 +1213,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
{
if (__i.__ptr_->__next_->__value_ == __v)
{
iterator __j = _STD::next(__i, 2);
iterator __j = next(__i, 2);
for (; __j != __e && *__j == __v; ++__j)
;
erase_after(__i, __j);
@@ -1335,7 +1236,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
{
if (__pred(__i.__ptr_->__next_->__value_))
{
iterator __j = _STD::next(__i, 2);
iterator __j = next(__i, 2);
for (; __j != __e && __pred(*__j); ++__j)
;
erase_after(__i, __j);
@@ -1355,7 +1256,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
{
for (iterator __i = begin(), __e = end(); __i != __e;)
{
iterator __j = _STD::next(__i);
iterator __j = next(__i);
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
;
if (__i.__ptr_->__next_ != __j.__ptr_)
@@ -1367,7 +1268,11 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
template <class _Tp, class _Alloc>
template <class _Compare>
void
#ifdef _LIBCPP_MOVE
forward_list<_Tp, _Alloc>::merge(forward_list&& __x, _Compare __comp)
#else
forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp)
#endif
{
if (this != &__x)
{
@@ -1425,7 +1330,7 @@ forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2,
template <class _Tp, class _Alloc>
template <class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
forward_list<_Tp, _Alloc>::sort(_Compare __comp)
{
@@ -1456,7 +1361,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
}
difference_type __sz1 = __sz / 2;
difference_type __sz2 = __sz - __sz1;
__node_pointer __t = _STD::next(iterator(__f1), __sz1 - 1).__ptr_;
__node_pointer __t = next(iterator(__f1), __sz1 - 1).__ptr_;
__node_pointer __f2 = __t->__next_;
__t->__next_ = nullptr;
return __merge(__sort(__f1, __sz1, __comp),
@@ -1500,7 +1405,7 @@ bool operator==(const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool operator!=(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
@@ -1508,7 +1413,7 @@ bool operator!=(const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool operator< (const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
@@ -1517,7 +1422,7 @@ bool operator< (const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool operator> (const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
@@ -1525,7 +1430,7 @@ bool operator> (const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool operator>=(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
@@ -1533,7 +1438,7 @@ bool operator>=(const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool operator<=(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
@@ -1541,7 +1446,7 @@ bool operator<=(const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
{

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -122,7 +122,7 @@ public:
void close();
};
template <class charT, class traits>
template <class charT, class traits>
void
swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
@@ -176,7 +176,7 @@ typedef basic_fstream<wchar_t> wfstream;
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_filebuf
class basic_filebuf
: public basic_streambuf<_CharT, _Traits>
{
public:
@@ -189,13 +189,13 @@ public:
// 27.9.1.2 Constructors/destructor:
basic_filebuf();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_filebuf(basic_filebuf&& __rhs);
#endif
virtual ~basic_filebuf();
// 27.9.1.3 Assign/swap:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_filebuf& operator=(basic_filebuf&& __rhs);
#endif
void swap(basic_filebuf& __rhs);
@@ -260,7 +260,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
setbuf(0, 4096);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
@@ -333,7 +333,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
swap(__rhs);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>::~basic_filebuf()
@@ -341,14 +341,14 @@ basic_filebuf<_CharT, _Traits>::~basic_filebuf()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
close();
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
if (__owns_eb_)
delete [] __extbuf_;
if (__owns_ib_)
@@ -579,7 +579,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
this->setg(this->eback(),
this->eback() + __unget_sz,
this->eback() + __unget_sz + __nmemb);
__c = traits_type::to_int_type(*this->gptr());
__c = *this->gptr();
}
}
else
@@ -587,7 +587,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
size_t __nmemb = _STD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
size_t __nmemb = min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
static_cast<size_t>(__extbufend_ - __extbufnext_));
codecvt_base::result __r;
state_type __svs = __st_;
@@ -602,18 +602,18 @@ basic_filebuf<_CharT, _Traits>::underflow()
if (__r == codecvt_base::noconv)
{
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
__c = traits_type::to_int_type(*this->gptr());
__c = *this->gptr();
}
else if (__inext != this->eback() + __unget_sz)
{
this->setg(this->eback(), this->eback() + __unget_sz, __inext);
__c = traits_type::to_int_type(*this->gptr());
__c = *this->gptr();
}
}
}
}
else
__c = traits_type::to_int_type(*this->gptr());
__c = *this->gptr();
if (this->eback() == &__1buf)
this->setg(0, 0, 0);
return __c;
@@ -789,7 +789,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
template <class _CharT, class _Traits>
typename basic_filebuf<_CharT, _Traits>::pos_type
basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __wch)
{
if (__file_ == 0 || sync())
return pos_type(off_type(-1));
@@ -957,7 +957,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
// basic_ifstream
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_ifstream
class basic_ifstream
: public basic_istream<_CharT, _Traits>
{
public:
@@ -970,11 +970,11 @@ public:
basic_ifstream();
explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_ifstream(basic_ifstream&& __rhs);
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_ifstream& operator=(basic_ifstream&& __rhs);
#endif
void swap(basic_ifstream& __rhs);
@@ -1014,7 +1014,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
this->setstate(ios_base::failbit);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1035,7 +1035,7 @@ basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1102,7 +1102,7 @@ basic_ifstream<_CharT, _Traits>::close()
// basic_ofstream
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_ofstream
class basic_ofstream
: public basic_ostream<_CharT, _Traits>
{
public:
@@ -1115,11 +1115,11 @@ public:
basic_ofstream();
explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_ofstream(basic_ofstream&& __rhs);
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_ofstream& operator=(basic_ofstream&& __rhs);
#endif
void swap(basic_ofstream& __rhs);
@@ -1159,7 +1159,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
this->setstate(ios_base::failbit);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1180,7 +1180,7 @@ basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1247,7 +1247,7 @@ basic_ofstream<_CharT, _Traits>::close()
// basic_fstream
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_fstream
class basic_fstream
: public basic_iostream<_CharT, _Traits>
{
public:
@@ -1260,11 +1260,11 @@ public:
basic_fstream();
explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_fstream(basic_fstream&& __rhs);
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_fstream& operator=(basic_fstream&& __rhs);
#endif
void swap(basic_fstream& __rhs);
@@ -1304,7 +1304,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
this->setstate(ios_base::failbit);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1325,7 +1325,7 @@ basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -52,7 +52,7 @@ namespace std // purposefully not versioned
{
template<class _E>
class _LIBCPP_VISIBLE initializer_list
class initializer_list
{
const _E* __begin_;
size_t __size_;

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -43,12 +43,10 @@ class __iom_t1
{
ios_base::fmtflags __mask_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x)
{
@@ -58,7 +56,6 @@ public:
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x)
{
@@ -80,12 +77,10 @@ class __iom_t2
{
ios_base::fmtflags __mask_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x)
{
@@ -95,7 +90,6 @@ public:
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x)
{
@@ -117,12 +111,10 @@ class __iom_t3
{
int __base_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t3(int __b) : __base_(__b) {}
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x)
{
@@ -135,7 +127,6 @@ public:
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x)
{
@@ -161,12 +152,10 @@ class __iom_t4
{
_CharT __fill_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t4(_CharT __c) : __fill_(__c) {}
template <class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x)
{
@@ -189,12 +178,10 @@ class __iom_t5
{
int __n_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t5(int __n) : __n_(__n) {}
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x)
{
@@ -204,7 +191,6 @@ public:
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x)
{
@@ -226,12 +212,10 @@ class __iom_t6
{
int __n_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t6(int __n) : __n_(__n) {}
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x)
{
@@ -241,7 +225,6 @@ public:
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x)
{
@@ -271,7 +254,6 @@ class __iom_t7
_MoneyT& __mon_;
bool __intl_;
public:
_LIBCPP_INLINE_VISIBILITY
__iom_t7(_MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {}
@@ -288,7 +270,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s)
{
@@ -305,7 +287,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
{
__is.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __is;
}
@@ -331,7 +313,6 @@ class __iom_t8
const _MoneyT& __mon_;
bool __intl_;
public:
_LIBCPP_INLINE_VISIBILITY
__iom_t8(const _MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {}
@@ -348,7 +329,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -364,7 +345,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -390,7 +371,6 @@ class __iom_t9
tm* __tm_;
const _CharT* __fmt_;
public:
_LIBCPP_INLINE_VISIBILITY
__iom_t9(tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {}
@@ -407,7 +387,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s)
{
@@ -425,7 +405,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
{
__is.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __is;
}
@@ -451,7 +431,6 @@ class __iom_t10
const tm* __tm_;
const _CharT* __fmt_;
public:
_LIBCPP_INLINE_VISIBILITY
__iom_t10(const tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {}
@@ -468,7 +447,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -485,7 +464,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -222,7 +222,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
typedef ptrdiff_t streamsize;
class _LIBCPP_VISIBLE ios_base
class ios_base
{
public:
class failure;
@@ -272,16 +272,16 @@ public:
class Init;
// 27.5.2.2 fmtflags state:
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
_LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
_LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
fmtflags flags() const;
fmtflags flags(fmtflags __fmtfl);
fmtflags setf(fmtflags __fmtfl);
fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
void unsetf(fmtflags __mask);
_LIBCPP_INLINE_VISIBILITY streamsize precision() const;
_LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
_LIBCPP_INLINE_VISIBILITY streamsize width() const;
_LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
streamsize precision() const;
streamsize precision(streamsize __prec);
streamsize width() const;
streamsize width(streamsize __wide);
// 27.5.2.3 locales:
locale imbue(const locale& __loc);
@@ -307,23 +307,22 @@ private:
public:
static bool sync_with_stdio(bool __sync = true);
_LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
iostate rdstate() const;
void clear(iostate __state = goodbit);
_LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
void setstate(iostate __state);
bool good() const;
bool eof() const;
bool fail() const;
bool bad() const;
_LIBCPP_INLINE_VISIBILITY bool good() const;
_LIBCPP_INLINE_VISIBILITY bool eof() const;
_LIBCPP_INLINE_VISIBILITY bool fail() const;
_LIBCPP_INLINE_VISIBILITY bool bad() const;
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except);
iostate exceptions() const;
void exceptions(iostate __except);
void __set_badbit_and_consider_rethrow();
void __set_failbit_and_consider_rethrow();
protected:
_LIBCPP_INLINE_VISIBILITY
ios_base() {// purposefully does no initialization
}
@@ -371,7 +370,7 @@ private:
};
//enum class io_errc
struct _LIBCPP_VISIBLE io_errc
struct io_errc
{
enum _ {
stream = 1
@@ -382,12 +381,9 @@ enum _ {
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
};
template <>
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
template <>
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
template <> struct is_error_code_enum<io_errc> : public true_type { };
template <> struct is_error_code_enum<io_errc::_> : public true_type { };
_LIBCPP_VISIBLE
const error_category& iostream_category();
inline _LIBCPP_INLINE_VISIBILITY
@@ -404,16 +400,16 @@ make_error_condition(io_errc __e)
return error_condition(static_cast<int>(__e), iostream_category());
}
class _LIBCPP_EXCEPTION_ABI ios_base::failure
class ios_base::failure
: public system_error
{
public:
{
public:
explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
virtual ~failure() throw();
};
class _LIBCPP_VISIBLE ios_base::Init
class ios_base::Init
{
public:
Init();
@@ -560,7 +556,7 @@ ios_base::exceptions(iostate __except)
}
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_ios
class basic_ios
: public ios_base
{
public:
@@ -587,52 +583,36 @@ public:
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
// 27.5.4.1 Constructor/destructor:
_LIBCPP_INLINE_VISIBILITY
explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
virtual ~basic_ios();
// 27.5.4.2 Members:
_LIBCPP_INLINE_VISIBILITY
basic_ostream<char_type, traits_type>* tie() const;
_LIBCPP_INLINE_VISIBILITY
basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
_LIBCPP_INLINE_VISIBILITY
basic_streambuf<char_type, traits_type>* rdbuf() const;
_LIBCPP_INLINE_VISIBILITY
basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
basic_ios& copyfmt(const basic_ios& __rhs);
_LIBCPP_INLINE_VISIBILITY
char_type fill() const;
_LIBCPP_INLINE_VISIBILITY
char_type fill(char_type __ch);
_LIBCPP_INLINE_VISIBILITY
locale imbue(const locale& __loc);
_LIBCPP_INLINE_VISIBILITY
char narrow(char_type __c, char __dfault) const;
_LIBCPP_INLINE_VISIBILITY
char_type widen(char __c) const;
protected:
_LIBCPP_ALWAYS_INLINE
basic_ios() {// purposefully does no initialization
}
_LIBCPP_INLINE_VISIBILITY
void init(basic_streambuf<char_type, traits_type>* __sb);
_LIBCPP_INLINE_VISIBILITY
void move(basic_ios& __rhs);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_ALWAYS_INLINE
#ifdef _LIBCPP_MOVE
void move(basic_ios&& __rhs) {move(__rhs);}
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(basic_ios& __rhs);
_LIBCPP_INLINE_VISIBILITY
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
private:
basic_ostream<char_type, traits_type>* __tie_;

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -20,7 +20,6 @@ namespace std
template<class charT> struct char_traits;
template<class T> class allocator;
class ios_base;
template <class charT, class traits = char_traits<charT> > class basic_ios;
template <class charT, class traits = char_traits<charT> > class basic_streambuf;
@@ -93,49 +92,32 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
_LIBCPP_BEGIN_NAMESPACE_STD
class ios_base;
template<class _CharT> struct char_traits;
template<class _Tp> class allocator;
template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
template<class _Tp> class _LIBCPP_VISIBLE allocator;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ios;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ios;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_streambuf;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_istream;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ostream;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_iostream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_streambuf;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_istream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ostream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_iostream;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
class basic_stringbuf;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
class basic_istringstream;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
class basic_ostringstream;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
class basic_stringstream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_stringbuf;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_istringstream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_ostringstream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_stringstream;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_filebuf;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ifstream;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ofstream;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_fstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_filebuf;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ifstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ofstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_fstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE ostreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> > class istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> > class ostreambuf_iterator;
typedef basic_ios<char> ios;
typedef basic_ios<wchar_t> wios;
@@ -170,20 +152,19 @@ typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream;
template <class _State> class _LIBCPP_VISIBLE fpos;
template <class _State> class fpos;
typedef fpos<mbstate_t> streampos;
typedef fpos<mbstate_t> wstreampos;
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef fpos<mbstate_t> u16streampos;
typedef fpos<mbstate_t> u32streampos;
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
#endif
typedef long long streamoff; // for char_traits in <string>
template <class _CharT, // for <stdexcept>
class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_string;
class _Allocator = allocator<_CharT> > class basic_string;
typedef basic_string<char, char_traits<char>, allocator<char> > string;
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -160,7 +160,7 @@ template <class charT, class traits, class T>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_istream
class basic_istream
: virtual public basic_ios<_CharT, _Traits>
{
streamsize __gc_;
@@ -176,12 +176,12 @@ public:
explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb);
virtual ~basic_istream();
protected:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_istream(basic_istream&& __rhs);
#endif
// 27.7.1.1.2 Assign/swap:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_istream& operator=(basic_istream&& __rhs);
#endif
void swap(basic_istream& __rhs);
@@ -211,7 +211,6 @@ public:
basic_istream& operator>>(void*& __p);
// 27.7.1.3 Unformatted input:
_LIBCPP_INLINE_VISIBILITY
streamsize gcount() const {return __gc_;}
int_type get();
basic_istream& get(char_type& __c);
@@ -238,7 +237,7 @@ public:
};
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_istream<_CharT, _Traits>::sentry
class basic_istream<_CharT, _Traits>::sentry
{
bool __ok_;
@@ -249,7 +248,6 @@ public:
explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
// ~sentry() = default;
_LIBCPP_INLINE_VISIBILITY
// explicit
operator bool() const {return __ok_;}
};
@@ -289,7 +287,7 @@ basic_istream<_CharT, _Traits>::basic_istream(basic_streambuf<char_type, traits_
this->init(__sb);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -309,7 +307,7 @@ basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>::~basic_istream()
@@ -332,7 +330,7 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -348,7 +346,7 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -359,7 +357,7 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -375,7 +373,7 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -386,7 +384,7 @@ basic_istream<_CharT, _Traits>::operator>>(long& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -402,7 +400,7 @@ basic_istream<_CharT, _Traits>::operator>>(long& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -413,7 +411,7 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -429,7 +427,7 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -440,7 +438,7 @@ basic_istream<_CharT, _Traits>::operator>>(long long& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -456,7 +454,7 @@ basic_istream<_CharT, _Traits>::operator>>(long long& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -467,7 +465,7 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -483,7 +481,7 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -494,7 +492,7 @@ basic_istream<_CharT, _Traits>::operator>>(float& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -510,7 +508,7 @@ basic_istream<_CharT, _Traits>::operator>>(float& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -521,7 +519,7 @@ basic_istream<_CharT, _Traits>::operator>>(double& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -537,7 +535,7 @@ basic_istream<_CharT, _Traits>::operator>>(double& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -548,7 +546,7 @@ basic_istream<_CharT, _Traits>::operator>>(long double& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -564,7 +562,7 @@ basic_istream<_CharT, _Traits>::operator>>(long double& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -575,7 +573,7 @@ basic_istream<_CharT, _Traits>::operator>>(bool& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -591,7 +589,7 @@ basic_istream<_CharT, _Traits>::operator>>(bool& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -602,7 +600,7 @@ basic_istream<_CharT, _Traits>::operator>>(void*& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -618,7 +616,7 @@ basic_istream<_CharT, _Traits>::operator>>(void*& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -629,7 +627,7 @@ basic_istream<_CharT, _Traits>::operator>>(short& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -658,7 +656,7 @@ basic_istream<_CharT, _Traits>::operator>>(short& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -669,7 +667,7 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -698,7 +696,7 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -736,7 +734,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen)
{
@@ -770,7 +768,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
{
__is.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __is;
}
@@ -797,17 +795,10 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen)
{
#if 1
typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
__is.setstate(ios_base::eofbit | ios_base::failbit);
else
__c = _Traits::to_char_type(__i);
#else
typedef istreambuf_iterator<_CharT, _Traits> _I;
_I __i(__is);
_I __eof;
@@ -819,7 +810,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
}
else
__is.setstate(ios_base::eofbit | ios_base::failbit);
#endif
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -827,7 +817,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
{
__is.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __is;
}
@@ -855,7 +845,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this, true);
if (__s)
{
@@ -865,7 +855,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef ostreambuf_iterator<char_type, traits_type> _O;
_I __i(*this);
@@ -890,7 +880,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
if (__c == 0)
this->__set_failbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
}
else
this->setstate(ios_base::failbit);
@@ -902,7 +892,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -915,7 +905,7 @@ basic_istream<_CharT, _Traits>::get()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this, true);
if (__s)
{
@@ -942,7 +932,7 @@ basic_istream<_CharT, _Traits>::get()
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __r;
}
@@ -965,7 +955,7 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
{
@@ -1000,7 +990,7 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1021,7 +1011,7 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
{
@@ -1030,7 +1020,7 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef ostreambuf_iterator<char_type, traits_type> _O;
_I __i(*this);
@@ -1052,7 +1042,7 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
if (__c == 0)
__err |= ios_base::failbit;
this->setstate(__err);
@@ -1064,7 +1054,7 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1084,7 +1074,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
{
@@ -1122,7 +1112,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1142,7 +1132,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
{
@@ -1182,7 +1172,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1195,7 +1185,7 @@ basic_istream<_CharT, _Traits>::peek()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
__r = this->rdbuf()->sgetc();
@@ -1205,7 +1195,7 @@ basic_istream<_CharT, _Traits>::peek()
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __r;
}
@@ -1217,7 +1207,7 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
{
@@ -1244,7 +1234,7 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1257,7 +1247,7 @@ basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
{
@@ -1273,7 +1263,7 @@ basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
case 0:
break;
default:
__c = _STD::min(__c, __n);
__c = min(__c, __n);
for (streamsize __k = 0; __k < __c; ++__k, ++__s, ++__i)
*__s = *__i;
}
@@ -1289,7 +1279,7 @@ basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __c;
}
@@ -1301,7 +1291,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
{
@@ -1316,7 +1306,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1328,7 +1318,7 @@ basic_istream<_CharT, _Traits>::unget()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
{
@@ -1343,7 +1333,7 @@ basic_istream<_CharT, _Traits>::unget()
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1355,7 +1345,7 @@ basic_istream<_CharT, _Traits>::sync()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
{
@@ -1373,7 +1363,7 @@ basic_istream<_CharT, _Traits>::sync()
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __r;
}
@@ -1385,7 +1375,7 @@ basic_istream<_CharT, _Traits>::tellg()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
__r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
@@ -1395,7 +1385,7 @@ basic_istream<_CharT, _Traits>::tellg()
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __r;
}
@@ -1406,7 +1396,7 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
@@ -1417,7 +1407,7 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1428,7 +1418,7 @@ basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this, true);
if (__sen)
this->rdbuf()->pubseekoff(__off, __dir, ios_base::in);
@@ -1438,7 +1428,7 @@ basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1449,7 +1439,7 @@ ws(basic_istream<_CharT, _Traits>& __is)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
if (__sen)
{
@@ -1469,11 +1459,11 @@ ws(basic_istream<_CharT, _Traits>& __is)
{
__is.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __is;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1484,10 +1474,10 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
return __is;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_iostream
class basic_iostream
: public basic_istream<_CharT, _Traits>,
public basic_ostream<_CharT, _Traits>
{
@@ -1503,12 +1493,12 @@ public:
explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb);
virtual ~basic_iostream();
protected:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_iostream(basic_iostream&& __rhs);
#endif
// assign/swap
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_iostream& operator=(basic_iostream&& __rhs);
#endif
void swap(basic_iostream& __rhs);
@@ -1522,7 +1512,7 @@ basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, trait
{
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1540,7 +1530,7 @@ basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits>
basic_iostream<_CharT, _Traits>::~basic_iostream()
@@ -1563,7 +1553,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen)
{
@@ -1601,19 +1591,19 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
{
__is.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __is;
}
template<class _CharT, class _Traits, class _Allocator>
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
if (__sen)
{
@@ -1652,24 +1642,24 @@ getline(basic_istream<_CharT, _Traits>& __is,
{
__is.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __is;
}
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
inline
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)
{
return getline(__is, __str, __is.widen('\n'));
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
inline
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
{
@@ -1677,15 +1667,15 @@ getline(basic_istream<_CharT, _Traits>&& __is,
}
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
inline
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)
{
return getline(__is, __str, __is.widen('\n'));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits, size_t _Size>
basic_istream<_CharT, _Traits>&
@@ -1694,7 +1684,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen)
{
@@ -1730,7 +1720,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
{
__is.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __is;
}

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -88,7 +88,7 @@ public:
typedef typename iterator_traits<Iterator>::difference_type difference_type;
typedef typename iterator_traits<Iterator>::reference reference;
typedef typename iterator_traits<Iterator>::pointer pointer;
reverse_iterator();
explicit reverse_iterator(Iterator x);
template <class U> reverse_iterator(const reverse_iterator<U>& u);
@@ -151,7 +151,7 @@ public:
typedef void pointer;
explicit back_insert_iterator(Container& x);
back_insert_iterator& operator=(const typename Container::value_type& value);
back_insert_iterator& operator=(typename Container::const_reference value);
back_insert_iterator& operator*();
back_insert_iterator& operator++();
back_insert_iterator operator++(int);
@@ -172,7 +172,7 @@ public:
typedef void pointer;
explicit front_insert_iterator(Container& x);
front_insert_iterator& operator=(const typename Container::value_type& value);
front_insert_iterator& operator=(typename Container::const_reference value);
front_insert_iterator& operator*();
front_insert_iterator& operator++();
front_insert_iterator operator++(int);
@@ -194,7 +194,7 @@ public:
typedef void pointer;
insert_iterator(Container& x, typename Container::iterator i);
insert_iterator& operator=(const typename Container::value_type& value);
insert_iterator& operator=(typename Container::const_reference value);
insert_iterator& operator*();
insert_iterator& operator++();
insert_iterator& operator++(int);
@@ -325,11 +325,11 @@ template <class T, size_t N> T* end(T (&array)[N]);
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_VISIBLE input_iterator_tag {};
struct _LIBCPP_VISIBLE output_iterator_tag {};
struct _LIBCPP_VISIBLE forward_iterator_tag : public input_iterator_tag {};
struct _LIBCPP_VISIBLE bidirectional_iterator_tag : public forward_iterator_tag {};
struct _LIBCPP_VISIBLE random_access_iterator_tag : public bidirectional_iterator_tag {};
struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
template <class _Tp>
struct __has_iterator_category
@@ -372,11 +372,11 @@ struct __iterator_traits<_Iter, true>
// the client expects instead of failing at compile time.
template <class _Iter>
struct _LIBCPP_VISIBLE iterator_traits
struct iterator_traits
: __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
template<class _Tp>
struct _LIBCPP_VISIBLE iterator_traits<_Tp*>
struct iterator_traits<_Tp*>
{
typedef ptrdiff_t difference_type;
typedef typename remove_const<_Tp>::type value_type;
@@ -407,7 +407,7 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_
template<class _Category, class _Tp, class _Distance = ptrdiff_t,
class _Pointer = _Tp*, class _Reference = _Tp&>
struct _LIBCPP_VISIBLE iterator
struct iterator
{
typedef _Tp value_type;
typedef _Distance difference_type;
@@ -482,29 +482,29 @@ distance(_InputIter __first, _InputIter __last)
}
template <class _ForwardIter>
inline _LIBCPP_INLINE_VISIBILITY
inline
_ForwardIter
next(_ForwardIter __x,
typename iterator_traits<_ForwardIter>::difference_type __n = 1,
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
{
_STD::advance(__x, __n);
advance(__x, __n);
return __x;
}
template <class _BidiretionalIter>
inline _LIBCPP_INLINE_VISIBILITY
inline
_BidiretionalIter
prev(_BidiretionalIter __x,
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
{
_STD::advance(__x, -__n);
advance(__x, -__n);
return __x;
}
template <class _Iter>
class _LIBCPP_VISIBLE reverse_iterator
class reverse_iterator
: public iterator<typename iterator_traits<_Iter>::iterator_category,
typename iterator_traits<_Iter>::value_type,
typename iterator_traits<_Iter>::difference_type,
@@ -520,7 +520,7 @@ public:
typedef typename iterator_traits<_Iter>::difference_type difference_type;
typedef typename iterator_traits<_Iter>::reference reference;
typedef typename iterator_traits<_Iter>::pointer pointer;
_LIBCPP_INLINE_VISIBILITY reverse_iterator() : current() {}
_LIBCPP_INLINE_VISIBILITY explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {}
template <class _Up> _LIBCPP_INLINE_VISIBILITY reverse_iterator(const reverse_iterator<_Up>& __u)
@@ -611,7 +611,7 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i
}
template <class _Container>
class _LIBCPP_VISIBLE back_insert_iterator
class back_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -624,12 +624,12 @@ public:
typedef _Container container_type;
_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=(typename _Container::const_reference __value)
{container->push_back(__value); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value)
{container->push_back(_STD::move(__value)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_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++(int) {return *this;}
@@ -644,7 +644,7 @@ back_inserter(_Container& __x)
}
template <class _Container>
class _LIBCPP_VISIBLE front_insert_iterator
class front_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -657,12 +657,12 @@ public:
typedef _Container container_type;
_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=(typename _Container::const_reference __value)
{container->push_front(__value); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value)
{container->push_front(_STD::move(__value)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_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++(int) {return *this;}
@@ -677,7 +677,7 @@ front_inserter(_Container& __x)
}
template <class _Container>
class _LIBCPP_VISIBLE insert_iterator
class insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -692,12 +692,12 @@ public:
_LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x), iter(__i) {}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value)
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::const_reference __value)
{iter = container->insert(iter, __value); ++iter; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value)
{iter = container->insert(iter, _STD::move(__value)); ++iter; return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int) {return *this;}
@@ -713,7 +713,7 @@ inserter(_Container& __x, typename _Container::iterator __i)
template <class _Tp, class _CharT = char,
class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
class _LIBCPP_VISIBLE istream_iterator
class istream_iterator
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
{
public:
@@ -752,7 +752,7 @@ public:
};
template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE ostream_iterator
class ostream_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@@ -781,7 +781,7 @@ public:
};
template<class _CharT, class _Traits>
class _LIBCPP_VISIBLE istreambuf_iterator
class istreambuf_iterator
: public iterator<input_iterator_tag, _CharT,
typename _Traits::off_type, _CharT*,
_CharT>
@@ -806,7 +806,6 @@ private:
_LIBCPP_INLINE_VISIBILITY char_type operator*() const {return __keep_;}
};
_LIBCPP_INLINE_VISIBILITY
void __test_for_eof()
{
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
@@ -821,7 +820,7 @@ public:
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
: __sbuf_(__p.__sbuf_) {}
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{
@@ -853,7 +852,7 @@ bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
{return !__a.equal(__b);}
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE ostreambuf_iterator
class ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@@ -881,7 +880,7 @@ public:
};
template <class _Iter>
class _LIBCPP_VISIBLE move_iterator
class move_iterator
{
private:
_Iter __i;
@@ -891,24 +890,19 @@ public:
typedef typename iterator_traits<iterator_type>::value_type value_type;
typedef typename iterator_traits<iterator_type>::difference_type difference_type;
typedef typename iterator_traits<iterator_type>::pointer pointer;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
typedef value_type&& reference;
#else
typedef typename iterator_traits<iterator_type>::reference reference;
#endif
_LIBCPP_INLINE_VISIBILITY move_iterator() : __i() {}
_LIBCPP_INLINE_VISIBILITY explicit move_iterator(_Iter __x) : __i(__x) {}
template <class _Up> _LIBCPP_INLINE_VISIBILITY move_iterator(const move_iterator<_Up>& __u)
: __i(__u.base()) {}
_LIBCPP_INLINE_VISIBILITY _Iter base() const {return __i;}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {
return static_cast<reference>(*__i);
}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {
typename iterator_traits<iterator_type>::reference __ref = *__i;
return &__ref;
}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__i;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;}
_LIBCPP_INLINE_VISIBILITY move_iterator operator++(int)
{move_iterator __tmp(*this); ++__i; return __tmp;}
@@ -924,9 +918,7 @@ public:
_LIBCPP_INLINE_VISIBILITY move_iterator& operator-=(difference_type __n)
{__i -= __n; return *this;}
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
{
return static_cast<reference>(__i[__n]);
}
{return __i[__n];}
};
template <class _Iter1, class _Iter2>
@@ -1045,7 +1037,7 @@ template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
template <class _Tp>
typename enable_if
<
is_trivially_copy_assignable<_Tp>::value,
has_trivial_copy_assign<_Tp>::value,
_Tp*
>::type
__unwrap_iter(__wrap_iter<_Tp*>);
@@ -1099,37 +1091,37 @@ private:
friend
bool
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2>
friend
bool
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2>
friend
bool
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2>
friend
bool
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2>
friend
bool
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2>
friend
bool
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2>
friend
typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1>
friend
__wrap_iter<_Iter1>
@@ -1144,7 +1136,7 @@ private:
friend
typename enable_if
<
is_trivially_copy_assignable<_Tp>::value,
has_trivial_copy_assign<_Tp>::value,
_Tp*
>::type
__unwrap_iter(__wrap_iter<_Tp*>);
@@ -1268,7 +1260,7 @@ private:
iterator_type __i;
__debug_iter* __next;
__container_type* __cont;
public:
_LIBCPP_INLINE_VISIBILITY __debug_iter() : __next(0), __cont(0) {}
_LIBCPP_INLINE_VISIBILITY __debug_iter(const __debug_iter& __x)
@@ -1305,7 +1297,7 @@ private:
void __remove_owner();
static void __remove_all(__container_type* __c);
static void swap(__container_type* __x, __container_type* __y);
_LIBCPP_INLINE_VISIBILITY bool __is_deref() const
{return __is_deref(__is_random_access_iterator<iterator_type>());}
bool __is_deref(false_type) const;
@@ -1335,37 +1327,37 @@ private:
friend
bool
operator==(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator<(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator!=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator>(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator>=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator<=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
typename __debug_iter<_Cp, _Iter1>::difference_type
operator-(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1>
friend
__debug_iter<_Cp, _Iter1>
@@ -1384,7 +1376,7 @@ __debug_iter<_Container, _Iter>::operator=(const __debug_iter& __x)
}
return *this;
}
template <class _Container, class _Iter>
void
__debug_iter<_Container, _Iter>::__set_owner(const __container_type* __c)
@@ -1623,10 +1615,10 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
#endif // _LIBCPP_DEBUG
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
#ifdef _LIBCPP_MOVE
template <class _C>
inline _LIBCPP_INLINE_VISIBILITY
inline
auto
begin(_C& __c) -> decltype(__c.begin())
{
@@ -1634,7 +1626,7 @@ begin(_C& __c) -> decltype(__c.begin())
}
template <class _C>
inline _LIBCPP_INLINE_VISIBILITY
inline
auto
begin(const _C& __c) -> decltype(__c.begin())
{
@@ -1642,7 +1634,7 @@ begin(const _C& __c) -> decltype(__c.begin())
}
template <class _C>
inline _LIBCPP_INLINE_VISIBILITY
inline
auto
end(_C& __c) -> decltype(__c.end())
{
@@ -1650,17 +1642,17 @@ end(_C& __c) -> decltype(__c.end())
}
template <class _C>
inline _LIBCPP_INLINE_VISIBILITY
inline
auto
end(const _C& __c) -> decltype(__c.end())
{
return __c.end();
}
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
#else
template <class _C>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename _C::iterator
begin(_C& __c)
{
@@ -1668,7 +1660,7 @@ begin(_C& __c)
}
template <class _C>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename _C::const_iterator
begin(const _C& __c)
{
@@ -1676,7 +1668,7 @@ begin(const _C& __c)
}
template <class _C>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename _C::iterator
end(_C& __c)
{
@@ -1684,17 +1676,17 @@ end(_C& __c)
}
template <class _C>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename _C::const_iterator
end(const _C& __c)
{
return __c.end();
}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
#endif
template <class _T, size_t _N>
inline _LIBCPP_INLINE_VISIBILITY
inline
_T*
begin(_T (&__array)[_N])
{
@@ -1702,7 +1694,7 @@ begin(_T (&__array)[_N])
}
template <class _T, size_t _N>
inline _LIBCPP_INLINE_VISIBILITY
inline
_T*
end(_T (&__array)[_N])
{

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -425,7 +425,7 @@ protected:
};
template <class _Tp>
class _LIBCPP_VISIBLE numeric_limits
class numeric_limits
: private __libcpp_numeric_limits<typename remove_cv<_Tp>::type>
{
typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base;
@@ -471,7 +471,7 @@ public:
};
template <class _Tp>
class _LIBCPP_VISIBLE numeric_limits<const _Tp>
class numeric_limits<const _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
@@ -517,7 +517,7 @@ public:
};
template <class _Tp>
class _LIBCPP_VISIBLE numeric_limits<volatile _Tp>
class numeric_limits<volatile _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
@@ -563,7 +563,7 @@ public:
};
template <class _Tp>
class _LIBCPP_VISIBLE numeric_limits<const volatile _Tp>
class numeric_limits<const volatile _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -187,7 +187,6 @@ struct __list_node_base
pointer __prev_;
pointer __next_;
_LIBCPP_INLINE_VISIBILITY
__list_node_base()
: __prev_(static_cast<pointer>(this)),
__next_(static_cast<pointer>(this))
@@ -206,7 +205,7 @@ template <class, class> class __list_imp;
template <class, class> class __list_const_iterator;
template <class _Tp, class _VoidPtr>
class _LIBCPP_VISIBLE __list_iterator
class __list_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -217,7 +216,6 @@ class _LIBCPP_VISIBLE __list_iterator
__node_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY
explicit __list_iterator(__node_pointer __p) : __ptr_(__p) {}
template<class, class> friend class list;
@@ -236,33 +234,23 @@ public:
pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
__list_iterator() {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY
__list_iterator& operator++() {__ptr_ = __ptr_->__next_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;}
_LIBCPP_INLINE_VISIBILITY
__list_iterator& operator--() {__ptr_ = __ptr_->__prev_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __list_iterator& __x, const __list_iterator& __y)
friend bool operator==(const __list_iterator& __x, const __list_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __list_iterator& __x, const __list_iterator& __y)
friend bool operator!=(const __list_iterator& __x, const __list_iterator& __y)
{return !(__x == __y);}
};
template <class _Tp, class _VoidPtr>
class _LIBCPP_VISIBLE __list_const_iterator
class __list_const_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -273,7 +261,6 @@ class _LIBCPP_VISIBLE __list_const_iterator
__node_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY
explicit __list_const_iterator(__node_pointer __p) : __ptr_(__p) {}
template<class, class> friend class list;
@@ -291,31 +278,20 @@ public:
pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator(__list_iterator<_Tp, _VoidPtr> __p) : __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator& operator++() {__ptr_ = __ptr_->__next_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator& operator--() {__ptr_ = __ptr_->__prev_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
friend bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y)
friend bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y)
{return !(__x == __y);}
};
@@ -351,13 +327,9 @@ protected:
__node_base __end_;
__compressed_pair<size_type, __node_allocator> __size_alloc_;
_LIBCPP_INLINE_VISIBILITY
size_type& __sz() {return __size_alloc_.first();}
_LIBCPP_INLINE_VISIBILITY
const size_type& __sz() const {return __size_alloc_.first();}
_LIBCPP_INLINE_VISIBILITY
__node_allocator& __node_alloc() {return __size_alloc_.second();}
_LIBCPP_INLINE_VISIBILITY
const __node_allocator& __node_alloc() const {return __size_alloc_.second();}
static void __unlink_nodes(__node_base& __f, __node_base& __l);
@@ -366,46 +338,35 @@ protected:
__list_imp(const allocator_type& __a);
~__list_imp();
void clear();
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __sz() == 0;}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return iterator(__end_.__next_);}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return const_iterator(__end_.__next_);}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return iterator(static_cast<__node_pointer> (&__end_));}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return const_iterator(static_cast<__node_const_pointer>(&__end_));}
void swap(__list_imp& __c);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __list_imp& __c)
{__copy_assign_alloc(__c, integral_constant<bool,
__node_alloc_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__list_imp& __c)
{__move_assign_alloc(__c, integral_constant<bool,
__node_alloc_traits::propagate_on_container_move_assignment::value>());}
private:
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__node_alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __list_imp& __c, true_type)
{
if (__node_alloc() != __c.__node_alloc())
@@ -413,24 +374,21 @@ private:
__node_alloc() = __c.__node_alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __list_imp& __c, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __list_imp& __c, true_type)
{
__node_alloc() = _STD::move(__c.__node_alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __list_imp& __c, false_type)
{}
};
// Unlink nodes [__f, __l]
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_base& __f, __node_base& __l)
{
@@ -439,14 +397,14 @@ __list_imp<_Tp, _Alloc>::__unlink_nodes(__node_base& __f, __node_base& __l)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__list_imp<_Tp, _Alloc>::__list_imp()
: __size_alloc_(0)
{
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a)
: __size_alloc_(0, __node_allocator(__a))
{
@@ -473,8 +431,8 @@ __list_imp<_Tp, _Alloc>::clear()
{
__node& __n = *__f.__ptr_;
++__f;
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
}
}
}
@@ -501,7 +459,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
}
template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_VISIBLE list
class list
: private __list_imp<_Tp, _Alloc>
{
typedef __list_imp<_Tp, _Alloc> base;
@@ -526,9 +484,7 @@ public:
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
list() {}
_LIBCPP_INLINE_VISIBILITY
list(const allocator_type& __a) : base(__a) {}
list(size_type __n);
list(size_type __n, const value_type& __x);
@@ -545,12 +501,11 @@ public:
list& operator=(const list& __c);
list(initializer_list<value_type> __il);
list(initializer_list<value_type> __il, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
list(list&& __c);
list(list&& __c, const allocator_type& __a);
list& operator=(list&& __c);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
list& operator=(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end()); return *this;}
@@ -558,67 +513,45 @@ public:
void assign(_InpIter __f, _InpIter __l,
typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
void assign(size_type __n, const value_type& __x);
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end());}
allocator_type get_allocator() const;
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return base::__sz();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return base::empty();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return numeric_limits<difference_type>::max();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return base::begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return base::begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return base::end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return base::end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return base::begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return base::end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
reference front() {return base::__end_.__next_->__value_;}
_LIBCPP_INLINE_VISIBILITY
const_reference front() const {return base::__end_.__next_->__value_;}
_LIBCPP_INLINE_VISIBILITY
reference back() {return base::__end_.__prev_->__value_;}
_LIBCPP_INLINE_VISIBILITY
const_reference back() const {return base::__end_.__prev_->__value_;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
void push_front(value_type&& __x);
void push_back(value_type&& __x);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
void emplace_front(_Args&&... __args);
template <class... _Args>
void emplace_back(_Args&&... __args);
template <class... _Args>
iterator emplace(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
iterator insert(const_iterator __p, value_type&& __x);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void push_front(const value_type& __x);
void push_back(const value_type& __x);
@@ -628,13 +561,10 @@ public:
template <class _InpIter>
iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, initializer_list<value_type> __il)
{return insert(__p, __il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
void swap(list& __c) {base::swap(__c);}
_LIBCPP_INLINE_VISIBILITY
void clear() {base::clear();}
void pop_front();
@@ -647,22 +577,19 @@ public:
void resize(size_type __n, const value_type& __x);
void splice(const_iterator __p, list& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
void splice(const_iterator __p, list&& __c) {splice(__p, __c);}
#endif
void splice(const_iterator __p, list& __c, const_iterator __i);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
void splice(const_iterator __p, list&& __c, const_iterator __i)
{splice(__p, __c, __i);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l)
{splice(__p, __c, __f, __l);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void remove(const value_type& __x);
template <class _Pred> void remove_if(_Pred __pred);
@@ -670,17 +597,15 @@ public:
template <class _BinaryPred>
void unique(_BinaryPred __binary_pred);
void merge(list& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
void merge(list&& __c) {merge(__c);}
#endif
template <class _Comp>
void merge(list& __c, _Comp __comp);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Comp>
_LIBCPP_INLINE_VISIBILITY
void merge(list&& __c, _Comp __comp) {merge(__c, __comp);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void sort();
template <class _Comp>
void sort(_Comp __comp);
@@ -699,7 +624,7 @@ private:
// Link in nodes [__f, __l] just prior to __p
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
list<_Tp, _Alloc>::__link_nodes(__node& __p, __node& __f, __node& __l)
{
@@ -710,19 +635,19 @@ list<_Tp, _Alloc>::__link_nodes(__node& __p, __node& __f, __node& __l)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::__iterator(size_type __n)
{
return __n <= base::__sz() / 2 ? _STD::next(begin(), __n)
: _STD::prev(end(), base::__sz() - __n);
return __n <= base::__sz() / 2 ? next(begin(), __n)
: prev(end(), base::__sz() - __n);
}
template <class _Tp, class _Alloc>
list<_Tp, _Alloc>::list(size_type __n)
{
for (; __n > 0; --__n)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
emplace_back();
#else
push_back(value_type());
@@ -799,7 +724,7 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
list<_Tp, _Alloc>&
list<_Tp, _Alloc>::operator=(const list& __c)
{
@@ -811,10 +736,10 @@ list<_Tp, _Alloc>::operator=(const list& __c)
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
list<_Tp, _Alloc>::list(list&& __c)
: base(allocator_type(_STD::move(__c.__node_alloc())))
{
@@ -822,7 +747,7 @@ list<_Tp, _Alloc>::list(list&& __c)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
: base(__a)
{
@@ -836,7 +761,7 @@ list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
list<_Tp, _Alloc>&
list<_Tp, _Alloc>::operator=(list&& __c)
{
@@ -867,7 +792,7 @@ list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
splice(end(), __c);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Alloc>
template <class _InpIter>
@@ -900,7 +825,7 @@ list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
_Alloc
list<_Tp, _Alloc>::get_allocator() const
{
@@ -915,7 +840,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
return iterator(__hold.release());
@@ -933,7 +858,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
++__ds;
__r = iterator(__hold.get());
__hold.release();
@@ -941,11 +866,11 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (--__n; __n != 0; --__n, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -956,7 +881,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
{
while (true)
{
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -965,7 +890,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
}
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__r.__ptr_, *__e.__ptr_);
base::__sz() += __ds;
}
@@ -986,7 +911,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), *__f);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), *__f);
++__ds;
__r = iterator(__hold.get());
__hold.release();
@@ -994,11 +919,11 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (++__f; __f != __l; ++__f, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), *__f);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), *__f);
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -1009,7 +934,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
{
while (true)
{
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -1018,7 +943,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
}
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__r.__ptr_, *__e.__ptr_);
base::__sz() += __ds;
}
@@ -1032,7 +957,7 @@ list<_Tp, _Alloc>::push_front(const value_type& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1045,13 +970,13 @@ list<_Tp, _Alloc>::push_back(const value_type& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Alloc>
void
@@ -1060,7 +985,7 @@ list<_Tp, _Alloc>::push_front(value_type&& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::move(__x));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1073,14 +998,12 @@ list<_Tp, _Alloc>::push_back(value_type&& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::move(__x));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Alloc>
template <class... _Args>
void
@@ -1089,7 +1012,7 @@ list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1103,7 +1026,7 @@ list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1118,14 +1041,12 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
return iterator(__hold.release());
}
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Alloc>
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
@@ -1134,13 +1055,13 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::move(__x));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
return iterator(__hold.release());
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Alloc>
void
@@ -1150,8 +1071,8 @@ list<_Tp, _Alloc>::pop_front()
__node& __n = *base::__end_.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
}
template <class _Tp, class _Alloc>
@@ -1162,8 +1083,8 @@ list<_Tp, _Alloc>::pop_back()
__node& __n = *base::__end_.__prev_;
base::__unlink_nodes(__n, __n);
--base::__sz();
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
}
template <class _Tp, class _Alloc>
@@ -1175,8 +1096,8 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
__node_pointer __r = __n.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
return iterator(__r);
}
@@ -1193,8 +1114,8 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
__node& __n = const_cast<__node&>(*__f.__ptr_);
++__f;
--base::__sz();
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
}
}
return iterator(const_cast<__node_pointer>(__l.__ptr_));
@@ -1214,18 +1135,18 @@ list<_Tp, _Alloc>::resize(size_type __n)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_));
__node_alloc_traits::construct(__na, addressof(__hold->__value_));
++__ds;
iterator __r = iterator(__hold.release());
iterator __e = __r;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (--__n; __n != 0; --__n, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_));
__node_alloc_traits::construct(__na, addressof(__hold->__value_));
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -1236,7 +1157,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
{
while (true)
{
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -1245,7 +1166,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
}
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__link_nodes(static_cast<__node&>(base::__end_), *__r.__ptr_, *__e.__ptr_);
base::__sz() += __ds;
}
@@ -1265,18 +1186,18 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
++__ds;
iterator __r = iterator(__hold.release());
iterator __e = __r;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (--__n; __n != 0; --__n, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -1287,7 +1208,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
{
while (true)
{
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -1296,10 +1217,10 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
}
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
__link_nodes(static_cast<__node&>(base::__end_), *__r.__ptr_, *__e.__ptr_);
base::__sz() += __ds;
}
}
}
template <class _Tp, class _Alloc>
@@ -1321,7 +1242,7 @@ template <class _Tp, class _Alloc>
void
list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
{
if (__p != __i && __p != _STD::next(__i))
if (__p != __i && __p != next(__i))
{
__node& __f = const_cast<__node&>(*__i.__ptr_);
base::__unlink_nodes(__f, __f);
@@ -1359,7 +1280,7 @@ list<_Tp, _Alloc>::remove(const value_type& __x)
{
if (*__i == __x)
{
iterator __j = _STD::next(__i);
iterator __j = next(__i);
for (; __j != __e && *__j == __x; ++__j)
;
__i = erase(__i, __j);
@@ -1378,7 +1299,7 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
{
if (__pred(*__i))
{
iterator __j = _STD::next(__i);
iterator __j = next(__i);
for (; __j != __e && __pred(*__j); ++__j)
;
__i = erase(__i, __j);
@@ -1389,7 +1310,7 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
list<_Tp, _Alloc>::unique()
{
@@ -1403,7 +1324,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
{
for (iterator __i = begin(), __e = end(); __i != __e;)
{
iterator __j = _STD::next(__i);
iterator __j = next(__i);
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
;
if (++__i != __j)
@@ -1412,7 +1333,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
list<_Tp, _Alloc>::merge(list& __c)
{
@@ -1435,7 +1356,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
if (__comp(*__f2, *__f1))
{
size_type __ds = 1;
iterator __m2 = _STD::next(__f2);
iterator __m2 = next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, ++__ds)
;
base::__sz() += __ds;
@@ -1444,7 +1365,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
__node& __l = *__m2.__ptr_->__prev_;
__f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = _STD::next(__f1);
__m2 = next(__f1);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
@@ -1456,7 +1377,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
list<_Tp, _Alloc>::sort()
{
@@ -1465,7 +1386,7 @@ list<_Tp, _Alloc>::sort()
template <class _Tp, class _Alloc>
template <class _Comp>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
list<_Tp, _Alloc>::sort(_Comp __comp)
{
@@ -1474,6 +1395,7 @@ list<_Tp, _Alloc>::sort(_Comp __comp)
template <class _Tp, class _Alloc>
template <class _Comp>
inline
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp)
{
@@ -1493,12 +1415,12 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
return __f1;
}
size_type __n2 = __n / 2;
iterator __e1 = _STD::next(__f1, __n2);
iterator __e1 = next(__f1, __n2);
iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp);
iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
if (__comp(*__f2, *__f1))
{
iterator __m2 = _STD::next(__f2);
iterator __m2 = next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
;
__node& __f = *__f2.__ptr_;
@@ -1506,7 +1428,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
__r = __f2;
__e1 = __f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = _STD::next(__f1);
__m2 = next(__f1);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
@@ -1516,7 +1438,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
{
if (__comp(*__f2, *__f1))
{
iterator __m2 = _STD::next(__f2);
iterator __m2 = next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
;
__node& __f = *__f2.__ptr_;
@@ -1525,7 +1447,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
__e1 = __m2;
__f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = _STD::next(__f1);
__m2 = next(__f1);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
@@ -1549,7 +1471,7 @@ list<_Tp, _Alloc>::reverse()
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1557,7 +1479,7 @@ operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1565,7 +1487,7 @@ operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1573,7 +1495,7 @@ operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1581,7 +1503,7 @@ operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1589,7 +1511,7 @@ operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1597,7 +1519,7 @@ operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
{

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -198,7 +198,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __APPLE__
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, _Tp __v)
@@ -207,7 +207,7 @@ __nolocale_sprintf(char* __restrict __str,
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, _Tp __v)
@@ -216,7 +216,7 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, int __prec, _Tp __v)
@@ -225,7 +225,7 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
{
@@ -233,7 +233,7 @@ __nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
_Tp __v)
@@ -242,7 +242,7 @@ __nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, _Tp* __v)
@@ -250,26 +250,22 @@ __nolocale_sscanf(const char* __restrict __str,
return sscanf_l(__str, 0, __format, __v);
}
inline _LIBCPP_INLINE_VISIBILITY
inline
int
__nolocale_isxdigit(int __c)
{
return isxdigit_l(__c, 0);
}
inline _LIBCPP_INLINE_VISIBILITY
inline
int
__nolocale_isdigit(int __c)
{
return isdigit_l(__c, 0);
}
#else // __APPLE__
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
#else /* !__APPLE__ */
inline int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, ...)
{
@@ -279,11 +275,7 @@ __nolocale_sprintf(char* __restrict __str,
va_end(__ap);
return __result;
}
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
inline int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, ...)
{
@@ -293,11 +285,7 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
va_end(__ap);
return __result;
}
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
inline int
__nolocale_asprintf(char** __ret,
const char* __restrict __format, ...)
{
@@ -307,11 +295,7 @@ __nolocale_asprintf(char** __ret,
va_end(__ap);
return __result;
}
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
inline int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, ...)
{
@@ -321,20 +305,17 @@ __nolocale_sscanf(const char* __restrict __str,
va_end(__ap);
return __result;
}
inline _LIBCPP_INLINE_VISIBILITY
int
inline int
__nolocale_isxdigit(int __c)
{
return isxdigit(__c);
}
inline _LIBCPP_INLINE_VISIBILITY
int
inline int
__nolocale_isdigit(int __c)
{
return isdigit(__c);
}
#endif // __APPLE__
#endif /* __APPLE__ */
// __scan_keyword
// Scans [__b, __e) until a match is found in the basic_strings range
@@ -475,6 +456,7 @@ struct __num_get_base
void __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
ios_base::iostate& __err);
template <class _CharT>
struct __num_get
: protected __num_get_base
@@ -522,12 +504,6 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
unsigned* __g, unsigned*& __g_end, _CharT* __atoms)
{
if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
{
*__a_end++ = __ct == __atoms[24] ? '+' : '-';
__dc = 0;
return 0;
}
if (__ct == __thousands_sep && __grouping.size() != 0)
{
if (__g_end-__g < __num_get_buf_sz)
@@ -538,28 +514,22 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
return 0;
}
ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms;
if (__f >= 24)
if (__f >= 26)
return -1;
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __src[__f];
switch (__base)
{
case 8:
case 10:
if (__f >= __base)
return -1;
break;
case 16:
if (__f < 22)
break;
if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
{
__dc = 0;
*__a_end++ = __src[__f];
return 0;
}
return -1;
break;
default:
if (__f >= 22)
return 0;
break;
}
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __src[__f];
++__dc;
return 0;
}
@@ -615,7 +585,7 @@ extern template class __num_get<char>;
extern template class __num_get<wchar_t>;
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE num_get
class num_get
: public locale::facet,
private __num_get<_CharT>
{
@@ -707,7 +677,6 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~num_get() {}
virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
@@ -745,27 +714,22 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
{
if (__a != __a_end)
{
int __save_errno = errno;
errno = 0;
char *__p2;
long long __ll = strtoll_l(__a, &__p2, __base, 0);
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
if (__p2 != __a_end)
{
__err = ios_base::failbit;
return 0;
}
else if (__current_errno == ERANGE ||
__ll < numeric_limits<_Tp>::min() ||
numeric_limits<_Tp>::max() < __ll)
else if (__ll > numeric_limits<_Tp>::max())
{
__err = ios_base::failbit;
if (__ll > 0)
return numeric_limits<_Tp>::max();
else
return numeric_limits<_Tp>::min();
return numeric_limits<_Tp>::max();
}
else if (__ll < numeric_limits<_Tp>::min())
{
__err = ios_base::failbit;
return numeric_limits<_Tp>::min();
}
return static_cast<_Tp>(__ll);
}
@@ -780,25 +744,14 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
{
if (__a != __a_end)
{
if (*__a == '-')
{
__err = ios_base::failbit;
return 0;
}
int __save_errno = errno;
errno = 0;
char *__p2;
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
if (__p2 != __a_end)
{
__err = ios_base::failbit;
return 0;
}
else if (__current_errno == ERANGE ||
numeric_limits<_Tp>::max() < __ll)
else if (__ll > numeric_limits<_Tp>::max())
{
__err = ios_base::failbit;
return numeric_limits<_Tp>::max();
@@ -883,7 +836,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
unsigned* __g_end = __g;
unsigned __dc = 0;
for (; __b != __e; ++__b)
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
__thousands_sep, __grouping, __g, __g_end,
__atoms))
break;
@@ -918,8 +871,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
unsigned* __g_end = __g;
unsigned __dc = 0;
for (; __b != __e; ++__b)
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
__thousands_sep, __grouping, __g, __g_end,
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
__thousands_sep, __grouping, __g, __g_end,
__atoms))
break;
if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz)
@@ -953,7 +906,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
unsigned* __g_end = __g;
unsigned __dc = 0;
for (; __b != __e; ++__b)
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
__thousands_sep, __grouping, __g, __g_end,
__atoms))
break;
@@ -988,7 +941,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
unsigned* __g_end = __g;
unsigned __dc = 0;
for (; __b != __e; ++__b)
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
__thousands_sep, __grouping, __g, __g_end,
__atoms))
break;
@@ -1023,7 +976,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
unsigned* __g_end = __g;
unsigned __dc = 0;
for (; __b != __e; ++__b)
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
__thousands_sep, __grouping, __g, __g_end,
__atoms))
break;
@@ -1058,7 +1011,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
unsigned* __g_end = __g;
unsigned __dc = 0;
for (; __b != __e; ++__b)
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
__thousands_sep, __grouping, __g, __g_end,
__atoms))
break;
@@ -1086,8 +1039,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
char_type __atoms[32];
char_type __decimal_point;
char_type __thousands_sep;
string __grouping = this->__stage2_float_prep(__iob, __atoms,
__decimal_point,
string __grouping = this->__stage2_float_prep(__iob, __atoms,
__decimal_point,
__thousands_sep);
char __a[__num_get_base::__num_get_buf_sz] = {0};
char* __a_end = __a;
@@ -1097,8 +1050,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
bool __in_units = true;
char __exp = 'E';
for (; __b != __e; ++__b)
if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end,
__decimal_point, __thousands_sep,
if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end,
__decimal_point, __thousands_sep,
__grouping, __g, __g_end,
__dc, __atoms))
break;
@@ -1126,8 +1079,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
char_type __atoms[32];
char_type __decimal_point;
char_type __thousands_sep;
string __grouping = this->__stage2_float_prep(__iob, __atoms,
__decimal_point,
string __grouping = this->__stage2_float_prep(__iob, __atoms,
__decimal_point,
__thousands_sep);
char __a[__num_get_base::__num_get_buf_sz] = {0};
char* __a_end = __a;
@@ -1137,8 +1090,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
bool __in_units = true;
char __exp = 'E';
for (; __b != __e; ++__b)
if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end,
__decimal_point, __thousands_sep,
if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end,
__decimal_point, __thousands_sep,
__grouping, __g, __g_end,
__dc, __atoms))
break;
@@ -1166,7 +1119,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
char_type __atoms[32];
char_type __decimal_point;
char_type __thousands_sep;
string __grouping = this->__stage2_float_prep(__iob, __atoms,
string __grouping = this->__stage2_float_prep(__iob, __atoms,
__decimal_point,
__thousands_sep);
char __a[__num_get_base::__num_get_buf_sz] = {0};
@@ -1177,8 +1130,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
bool __in_units = true;
char __exp = 'E';
for (; __b != __e; ++__b)
if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end,
__decimal_point, __thousands_sep,
if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end,
__decimal_point, __thousands_sep,
__grouping, __g, __g_end,
__dc, __atoms))
break;
@@ -1215,8 +1168,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
unsigned* __g_end = __g;
unsigned __dc = 0;
for (; __b != __e; ++__b)
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
__thousands_sep, __grouping,
if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc,
__thousands_sep, __grouping,
__g, __g_end, __atoms))
break;
// Stage 3
@@ -1383,7 +1336,7 @@ extern template class __num_put<char>;
extern template class __num_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE num_put
class num_put
: public locale::facet,
private __num_put<_CharT>
{
@@ -1454,7 +1407,6 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~num_put() {}
virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
@@ -1789,14 +1741,14 @@ __get_up_to_n_digits(_InputIterator& __b, _InputIterator __e,
return __r;
}
class _LIBCPP_VISIBLE time_base
class time_base
{
public:
enum dateorder {no_order, dmy, mdy, ymd, ydm};
};
template <class _CharT>
class __time_get_c_storage // purposefully not decorated
class __time_get_c_storage
{
protected:
typedef basic_string<_CharT> string_type;
@@ -1811,7 +1763,7 @@ protected:
};
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE time_get
class time_get
: public locale::facet,
public time_base,
private __time_get_c_storage<_CharT>
@@ -1882,7 +1834,6 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~time_get() {}
virtual dateorder do_date_order() const;
@@ -2346,12 +2297,6 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
}
break;
case 'F':
{
const char_type __fmt[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
}
break;
case 'H':
__get_hour(__tm->tm_hour, __b, __e, __err, __ct);
break;
@@ -2462,7 +2407,7 @@ private:
};
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE time_get_byname
class time_get_byname
: public time_get<_CharT, _InputIterator>,
private __time_get_storage<_CharT>
{
@@ -2472,35 +2417,24 @@ public:
typedef _CharT char_type;
typedef basic_string<char_type> string_type;
_LIBCPP_INLINE_VISIBILITY
explicit time_get_byname(const char* __nm, size_t __refs = 0)
: time_get<_CharT, _InputIterator>(__refs),
__time_get_storage<_CharT>(__nm) {}
_LIBCPP_INLINE_VISIBILITY
explicit time_get_byname(const string& __nm, size_t __refs = 0)
: time_get<_CharT, _InputIterator>(__refs),
__time_get_storage<_CharT>(__nm) {}
protected:
_LIBCPP_INLINE_VISIBILITY
~time_get_byname() {}
_LIBCPP_INLINE_VISIBILITY
virtual dateorder do_date_order() const {return this->__do_date_order();}
private:
_LIBCPP_INLINE_VISIBILITY
virtual const string_type* __weeks() const {return this->__weeks_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type* __months() const {return this->__months_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type* __am_pm() const {return this->__am_pm_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __c() const {return this->__c_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __r() const {return this->__r_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __x() const {return this->__x_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __X() const {return this->__X_;}
};
@@ -2522,7 +2456,7 @@ protected:
};
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE time_put
class time_put
: public locale::facet,
private __time_put
{
@@ -2547,16 +2481,13 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~time_put() {}
virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm,
char __fmt, char __mod) const;
_LIBCPP_ALWAYS_INLINE
explicit time_put(const char* __nm, size_t __refs)
: locale::facet(__refs),
__time_put(__nm) {}
_LIBCPP_ALWAYS_INLINE
explicit time_put(const string& __nm, size_t __refs)
: locale::facet(__refs),
__time_put(__nm) {}
@@ -2614,14 +2545,14 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char_type* __nb = __nar;
char_type* __ne = __nb + 100;
__do_put(__nb, __ne, __tm, __fmt, __mod);
return _STD::copy(__nb, __ne, __s);
return copy(__nb, __ne, __s);
}
extern template class time_put<char>;
extern template class time_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE time_put_byname
class time_put_byname
: public time_put<_CharT, _OutputIterator>
{
public:
@@ -2634,7 +2565,6 @@ public:
: time_put<_CharT, _OutputIterator>(__nm, __refs) {}
protected:
_LIBCPP_ALWAYS_INLINE
~time_put_byname() {}
};
@@ -2643,7 +2573,7 @@ extern template class time_put_byname<wchar_t>;
// money_base
class _LIBCPP_VISIBLE money_base
class money_base
{
public:
enum part {none, space, symbol, sign, value};
@@ -2655,7 +2585,7 @@ public:
// moneypunct
template <class _CharT, bool _International = false>
class _LIBCPP_VISIBLE moneypunct
class moneypunct
: public locale::facet,
public money_base
{
@@ -2663,7 +2593,6 @@ public:
typedef _CharT char_type;
typedef basic_string<char_type> string_type;
_LIBCPP_ALWAYS_INLINE
explicit moneypunct(size_t __refs = 0)
: locale::facet(__refs) {}
@@ -2681,7 +2610,6 @@ public:
static const bool intl = _International;
protected:
_LIBCPP_ALWAYS_INLINE
~moneypunct() {}
virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();}
@@ -2709,8 +2637,7 @@ extern template class moneypunct<wchar_t, true>;
// moneypunct_byname
template <class _CharT, bool _International = false>
class _LIBCPP_VISIBLE moneypunct_byname
: public moneypunct<_CharT, _International>
class moneypunct_byname : public moneypunct<_CharT, _International>
{
public:
typedef money_base::pattern pattern;
@@ -2726,7 +2653,6 @@ public:
: moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());}
protected:
_LIBCPP_ALWAYS_INLINE
~moneypunct_byname() {}
virtual char_type do_decimal_point() const {return __decimal_point_;}
@@ -2821,7 +2747,7 @@ extern template class __money_get<char>;
extern template class __money_get<wchar_t>;
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE money_get
class money_get
: public locale::facet,
private __money_get<_CharT>
{
@@ -2852,9 +2778,8 @@ public:
protected:
_LIBCPP_ALWAYS_INLINE
~money_get() {}
virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
ios_base& __iob, ios_base::iostate& __err,
long double& __v) const;
@@ -2942,7 +2867,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
return false;
}
}
// drop through
// drop through
case money_base::none:
if (__p != 3)
{
@@ -3282,7 +3207,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
break;
case money_base::symbol:
if (!__sym.empty() && (__flags & ios_base::showbase))
__me = _STD::copy(__sym.begin(), __sym.end(), __me);
__me = copy(__sym.begin(), __sym.end(), __me);
break;
case money_base::value:
{
@@ -3341,7 +3266,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
}
// print rest of sign, if any
if (__sn.size() > 1)
__me = _STD::copy(__sn.begin()+1, __sn.end(), __me);
__me = copy(__sn.begin()+1, __sn.end(), __me);
// set alignment
if ((__flags & ios_base::adjustfield) == ios_base::left)
__mi = __me;
@@ -3353,7 +3278,7 @@ extern template class __money_put<char>;
extern template class __money_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE money_put
class money_put
: public locale::facet,
private __money_put<_CharT>
{
@@ -3383,7 +3308,6 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~money_put() {}
virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
@@ -3505,16 +3429,16 @@ extern template class money_put<wchar_t>;
// messages
class _LIBCPP_VISIBLE messages_base
class messages_base
{
public:
typedef ptrdiff_t catalog;
typedef nl_catd catalog;
_LIBCPP_ALWAYS_INLINE messages_base() {}
};
template <class _CharT>
class _LIBCPP_VISIBLE messages
class messages
: public locale::facet,
public messages_base
{
@@ -3548,7 +3472,6 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~messages() {}
virtual catalog do_open(const basic_string<char>&, const locale&) const;
@@ -3565,10 +3488,7 @@ template <class _CharT>
typename messages<_CharT>::catalog
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
{
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
if (__cat != -1)
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
return __cat;
return catopen(__nm.c_str(), NL_CAT_LOCALE);
}
template <class _CharT>
@@ -3580,10 +3500,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
__dflt.c_str(),
__dflt.c_str() + __dflt.size());
if (__c != -1)
__c <<= 1;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
char* __n = catgets(__c, __set, __msgid, __ndflt.c_str());
string_type __w;
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
__n, __n + strlen(__n));
@@ -3594,17 +3511,14 @@ template <class _CharT>
void
messages<_CharT>::do_close(catalog __c) const
{
if (__c != -1)
__c <<= 1;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
catclose(__cat);
catclose(__c);
}
extern template class messages<char>;
extern template class messages<wchar_t>;
template <class _CharT>
class _LIBCPP_VISIBLE messages_byname
class messages_byname
: public messages<_CharT>
{
public:
@@ -3620,7 +3534,6 @@ public:
: messages<_CharT>(__refs) {}
protected:
_LIBCPP_ALWAYS_INLINE
~messages_byname() {}
};
@@ -3630,7 +3543,7 @@ extern template class messages_byname<wchar_t>;
template<class _Codecvt, class _Elem = wchar_t,
class _Wide_alloc = allocator<_Elem>,
class _Byte_alloc = allocator<char> >
class _LIBCPP_VISIBLE wstring_convert
class wstring_convert
{
public:
typedef basic_string<char, char_traits<char>, _Byte_alloc> byte_string;
@@ -3652,41 +3565,33 @@ public:
wstring_convert(_Codecvt* __pcvt, state_type __state);
wstring_convert(const byte_string& __byte_err,
const wide_string& __wide_err = wide_string());
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
wstring_convert(wstring_convert&& __wc);
#endif
~wstring_convert();
_LIBCPP_ALWAYS_INLINE
wide_string from_bytes(char __byte)
{return from_bytes(&__byte, &__byte+1);}
_LIBCPP_ALWAYS_INLINE
wide_string from_bytes(const char* __ptr)
{return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));}
_LIBCPP_ALWAYS_INLINE
wide_string from_bytes(const byte_string& __str)
{return from_bytes(__str.data(), __str.data() + __str.size());}
wide_string from_bytes(const char* __first, const char* __last);
_LIBCPP_ALWAYS_INLINE
byte_string to_bytes(_Elem __wchar)
{return to_bytes(&__wchar, &__wchar+1);}
_LIBCPP_ALWAYS_INLINE
byte_string to_bytes(const _Elem* __wptr)
{return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));}
_LIBCPP_ALWAYS_INLINE
byte_string to_bytes(const wide_string& __wstr)
{return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());}
byte_string to_bytes(const _Elem* __first, const _Elem* __last);
_LIBCPP_ALWAYS_INLINE
size_t converted() const {return __cvtcount_;}
_LIBCPP_ALWAYS_INLINE
state_type state() const {return __cvtstate_;}
};
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline _LIBCPP_ALWAYS_INLINE
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt)
: __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
@@ -3694,7 +3599,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
}
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline _LIBCPP_ALWAYS_INLINE
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt, state_type __state)
: __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
@@ -3710,10 +3615,10 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
__cvtptr_ = new _Codecvt;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline _LIBCPP_ALWAYS_INLINE
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(wstring_convert&& __wc)
: __byte_err_string_(_STD::move(__wc.__byte_err_string_)),
@@ -3724,7 +3629,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
__wc.__cvtptr_ = nullptr;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert()
@@ -3785,10 +3690,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
if (__r == codecvt_base::ok)
return __ws;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__wide_err_string_.empty())
throw range_error("wstring_convert: from_bytes error");
#endif // _LIBCPP_NO_EXCEPTIONS
return __wide_err_string_;
}
@@ -3873,15 +3776,13 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
return __bs;
}
}
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__byte_err_string_.empty())
throw range_error("wstring_convert: to_bytes error");
#endif // _LIBCPP_NO_EXCEPTIONS
return __byte_err_string_;
}
template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> >
class _LIBCPP_VISIBLE wbuffer_convert
class wbuffer_convert
: public basic_streambuf<_Elem, _Tr>
{
public:
@@ -3916,9 +3817,7 @@ public:
state_type __state = state_type());
~wbuffer_convert();
_LIBCPP_INLINE_VISIBILITY
streambuf* rdbuf() const {return __bufptr_;}
_LIBCPP_INLINE_VISIBILITY
streambuf* rdbuf(streambuf* __bytebuf)
{
streambuf* __r = __bufptr_;
@@ -3926,7 +3825,6 @@ public:
return __r;
}
_LIBCPP_INLINE_VISIBILITY
state_type state() const {return __st_;}
protected:
@@ -4010,7 +3908,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
streamsize __nmemb = _STD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
streamsize __nmemb = min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
static_cast<streamsize>(__extbufend_ - __extbufnext_));
codecvt_base::result __r;
state_type __svs = __st_;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -175,15 +175,12 @@ template<class Callable, class ...Args>
#include <__config>
#include <__mutex_base>
#include <functional>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#pragma GCC system_header
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_VISIBLE recursive_mutex
class recursive_mutex
{
pthread_mutex_t __m_;
@@ -201,11 +198,10 @@ public:
void unlock();
typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY
native_handle_type native_handle() {return &__m_;}
};
class _LIBCPP_VISIBLE timed_mutex
class timed_mutex
{
mutex __m_;
condition_variable __cv_;
@@ -222,9 +218,8 @@ public:
void lock();
bool try_lock();
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);}
{return try_lock_until(chrono::monotonic_clock::now() + __d);}
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock();
@@ -247,7 +242,7 @@ timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
return false;
}
class _LIBCPP_VISIBLE recursive_timed_mutex
class recursive_timed_mutex
{
mutex __m_;
condition_variable __cv_;
@@ -265,9 +260,8 @@ public:
void lock();
bool try_lock();
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);}
{return try_lock_until(chrono::monotonic_clock::now() + __d);}
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock();
@@ -336,7 +330,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
return __r;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif
template <class _L0, class _L1>
void
@@ -367,9 +361,9 @@ lock(_L0& __l0, _L1& __l1)
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _L0, class _L1, class _L2, class ..._L3>
template <class _L0, class _L1, class ..._L2>
void
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
{
while (true)
{
@@ -378,7 +372,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
case 0:
{
unique_lock<_L0> __u0(__l0);
__i = try_lock(__l1, __l2, __l3...);
__i = try_lock(__l1, __l2...);
if (__i == -1)
{
__u0.release();
@@ -391,35 +385,35 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
case 1:
{
unique_lock<_L1> __u1(__l1);
__i = try_lock(__l2, __l3..., __l0);
__i = try_lock(__l2..., __l0);
if (__i == -1)
{
__u1.release();
return;
}
}
if (__i == sizeof...(_L3) + 1)
if (__i == sizeof...(_L2))
__i = 0;
else
__i += 2;
sched_yield();
break;
default:
__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
__lock_first(__i - 2, __l2..., __l0, __l1);
return;
}
}
}
template <class _L0, class _L1, class _L2, class ..._L3>
inline _LIBCPP_INLINE_VISIBILITY
template <class _L0, class _L1, class ..._L2>
inline
void
lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
lock(_L0& __l0, _L1& __l1, _L2& ...__l2)
{
__lock_first(0, __l0, __l1, __l2, __l3...);
__lock_first(0, __l0, __l1, __l2...);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif
struct once_flag;
@@ -428,16 +422,15 @@ struct once_flag;
template<class _Callable, class... _Args>
void call_once(once_flag&, _Callable&&, _Args&&...);
#else // _LIBCPP_HAS_NO_VARIADICS
#else
template<class _Callable>
void call_once(once_flag&, _Callable);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif
struct _LIBCPP_VISIBLE once_flag
struct once_flag
{
_LIBCPP_INLINE_VISIBILITY
// constexpr
once_flag() {}
@@ -451,68 +444,30 @@ private:
template<class _Callable, class... _Args>
friend
void call_once(once_flag&, _Callable&&, _Args&&...);
#else // _LIBCPP_HAS_NO_VARIADICS
#else
template<class _Callable>
friend
void call_once(once_flag&, _Callable);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F>
class __call_once_param
{
_F __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _F& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()()
{
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
__execute(_Index());
}
private:
template <size_t ..._Indices>
_LIBCPP_INLINE_VISIBILITY
void __execute(__tuple_indices<_Indices...>)
{
__invoke(_STD::move(_STD::get<0>(__f_)), _STD::move(_STD::get<_Indices>(__f_))...);
}
};
#else
template <class _F>
class __call_once_param
{
_F __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _F& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()()
{
__f_();
}
};
#endif
template <class _F>
void
__call_once_proxy(void* __vp)
@@ -532,14 +487,15 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
{
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
{
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
__call_once_param<_G> __p(_G(__decay_copy(_STD::forward<_Callable>(__func)),
__decay_copy(_STD::forward<_Args>(__args))...));
typedef decltype(std::bind(std::forward<_Callable>(__func),
std::forward<_Args>(__args)...)) _G;
__call_once_param<_G> __p(std::bind(std::forward<_Callable>(__func),
std::forward<_Args>(__args)...));
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
}
}
#else // _LIBCPP_HAS_NO_VARIADICS
#else
template<class _Callable>
inline _LIBCPP_INLINE_VISIBILITY
@@ -553,7 +509,7 @@ call_once(once_flag& __flag, _Callable __func)
}
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -32,7 +32,6 @@ struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
new_handler set_new_handler(new_handler new_p) throw();
new_handler get_new_handler() throw();
} // std
@@ -66,7 +65,7 @@ class _LIBCPP_EXCEPTION_ABI bad_alloc
: public exception
{
public:
bad_alloc() throw();
bad_alloc() throw();
virtual ~bad_alloc() throw();
virtual const char* what() const throw();
};
@@ -82,11 +81,10 @@ public:
void __throw_bad_alloc(); // not in C++ spec
struct _LIBCPP_VISIBLE nothrow_t {};
struct nothrow_t {};
extern _LIBCPP_VISIBLE const nothrow_t nothrow;
typedef void (*new_handler)();
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) throw();
_LIBCPP_VISIBLE new_handler get_new_handler() throw();
} // std

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -138,7 +138,7 @@ template <class charT, class traits, class T>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_ostream
class basic_ostream
: virtual public basic_ios<_CharT, _Traits>
{
public:
@@ -153,12 +153,12 @@ public:
explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb);
virtual ~basic_ostream();
protected:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_ostream(basic_ostream&& __rhs);
#endif
// 27.7.2.3 Assign/swap
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_ostream& operator=(basic_ostream&& __rhs);
#endif
void swap(basic_ostream& __rhs);
@@ -203,7 +203,7 @@ protected:
};
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_ostream<_CharT, _Traits>::sentry
class basic_ostream<_CharT, _Traits>::sentry
{
bool __ok_;
basic_ostream<_CharT, _Traits>& __os_;
@@ -242,7 +242,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
if (__os_.rdbuf()->pubsync() == -1)
__os_.setstate(ios_base::badbit);
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -250,7 +250,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry()
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
}
}
@@ -261,7 +261,7 @@ basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_
this->init(__sb);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -279,7 +279,7 @@ basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>::~basic_ostream()
@@ -328,7 +328,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -337,7 +337,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typedef istreambuf_iterator<_CharT, _Traits> _I;
typedef ostreambuf_iterator<_CharT, _Traits> _O;
_I __i(__sb);
@@ -358,7 +358,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
{
this->__set_failbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
}
else
this->setstate(ios_base::badbit);
@@ -369,7 +369,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -380,7 +380,7 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -395,7 +395,7 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -406,7 +406,7 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -425,7 +425,7 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -436,7 +436,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -451,7 +451,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -462,7 +462,7 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -481,7 +481,7 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -492,7 +492,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -507,7 +507,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -518,7 +518,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -533,7 +533,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -544,7 +544,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -559,7 +559,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -570,7 +570,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -585,7 +585,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -596,7 +596,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -611,7 +611,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -622,7 +622,7 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -637,7 +637,7 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -648,7 +648,7 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -663,7 +663,7 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -674,7 +674,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -689,7 +689,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -700,7 +700,7 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -715,7 +715,7 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -726,7 +726,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -747,7 +747,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -758,7 +758,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -780,7 +780,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -791,7 +791,7 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -812,7 +812,7 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -823,7 +823,7 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -844,7 +844,7 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -855,7 +855,7 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -876,7 +876,7 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -887,7 +887,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -909,7 +909,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -920,7 +920,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -955,7 +955,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -966,7 +966,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -988,7 +988,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -999,7 +999,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -1021,7 +1021,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -1032,7 +1032,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -1054,7 +1054,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -1065,7 +1065,7 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __s(*this);
if (__s)
{
@@ -1081,7 +1081,7 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1092,7 +1092,7 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
sentry __sen(*this);
if (__sen && __n)
{
@@ -1114,7 +1114,7 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1125,7 +1125,7 @@ basic_ostream<_CharT, _Traits>::flush()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
if (this->rdbuf())
{
sentry __s(*this);
@@ -1141,7 +1141,7 @@ basic_ostream<_CharT, _Traits>::flush()
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return *this;
}
@@ -1206,7 +1206,7 @@ flush(basic_ostream<_CharT, _Traits>& __os)
return __os;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Stream, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1222,7 +1222,7 @@ operator<<(_Stream&& __os, const _Tp& __x)
return __os;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template<class _CharT, class _Traits, class _Allocator>
basic_ostream<_CharT, _Traits>&
@@ -1232,7 +1232,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -1254,7 +1254,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
{
__os.__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __os;
}
@@ -1276,7 +1276,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
template <class _CharT, class _Traits, size_t _Size>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
operator<<(basic_ostream<_CharT, _Traits>& __os, bitset<_Size>& __x)
{
return __os << __x.template to_string<_CharT, _Traits>
(use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -167,7 +167,7 @@ bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> >
class _LIBCPP_VISIBLE queue
class queue
{
public:
typedef _Container container_type;
@@ -180,86 +180,63 @@ protected:
container_type c;
public:
_LIBCPP_INLINE_VISIBILITY
queue() : c() {}
_LIBCPP_INLINE_VISIBILITY
explicit queue(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
explicit queue(container_type&& __c) : c(_STD::move(__c)) {}
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q) : c(_STD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(const queue& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__q.c, __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(const container_type& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__c, __a) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__c), __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__q.c), __a) {}
_LIBCPP_INLINE_VISIBILITY
queue& operator=(queue&& __q)
{
c = _STD::move(__q.c);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return c.size();}
_LIBCPP_INLINE_VISIBILITY
reference front() {return c.front();}
_LIBCPP_INLINE_VISIBILITY
const_reference front() const {return c.front();}
_LIBCPP_INLINE_VISIBILITY
reference back() {return c.back();}
_LIBCPP_INLINE_VISIBILITY
const_reference back() const {return c.back();}
_LIBCPP_INLINE_VISIBILITY
void push(const value_type& __v) {c.push_back(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args)
{c.emplace_back(_STD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
void pop() {c.pop_front();}
_LIBCPP_INLINE_VISIBILITY
void swap(queue& __q)
{
using _STD::swap;
@@ -268,19 +245,17 @@ public:
template <class _T1, class _C1>
friend
_LIBCPP_INLINE_VISIBILITY
bool
operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
template <class _T1, class _C1>
friend
_LIBCPP_INLINE_VISIBILITY
bool
operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
};
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -288,7 +263,7 @@ operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -296,7 +271,7 @@ operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -304,7 +279,7 @@ operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -312,7 +287,7 @@ operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -320,7 +295,7 @@ operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -328,7 +303,7 @@ operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
{
@@ -336,14 +311,14 @@ swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container, class _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<queue<_Tp, _Container>, _Alloc>
struct uses_allocator<queue<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};
template <class _Tp, class _Container = vector<_Tp>,
class _Compare = less<typename _Container::value_type> >
class _LIBCPP_VISIBLE priority_queue
class priority_queue
{
public:
typedef _Container container_type;
@@ -358,11 +333,10 @@ protected:
value_compare comp;
public:
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const value_compare& __comp = value_compare())
: c(), comp(__comp) {}
priority_queue(const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
explicit priority_queue(const value_compare& __comp, container_type&& __c);
#endif
template <class _InputIter>
@@ -371,13 +345,13 @@ public:
template <class _InputIter>
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _InputIter>
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, container_type&& __c);
priority_queue(priority_queue&& __q);
priority_queue& operator=(priority_queue&& __q);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Alloc>
explicit priority_queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
@@ -395,7 +369,7 @@ public:
priority_queue(const priority_queue& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Alloc>
priority_queue(const value_compare& __comp, container_type&& __c,
const _Alloc& __a,
@@ -405,29 +379,24 @@ public:
priority_queue(priority_queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return c.size();}
_LIBCPP_INLINE_VISIBILITY
const_reference top() const {return c.front();}
void push(const value_type& __v);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
void push(value_type&& __v);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args> void emplace(_Args&&... __args);
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void pop();
void swap(priority_queue& __q);
};
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
const container_type& __c)
: c(__c),
@@ -436,10 +405,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp
_STD::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
container_type&& __c)
: c(_STD::move(__c)),
@@ -448,11 +417,11 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
_STD::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp)
: c(__f, __l),
@@ -463,7 +432,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp,
const container_type& __c)
@@ -474,11 +443,11 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
_STD::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp,
container_type&& __c)
@@ -490,7 +459,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
}
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q)
: c(_STD::move(__q.c)),
comp(_STD::move(__q.comp))
@@ -506,11 +475,11 @@ priority_queue<_Tp, _Container, _Compare>::operator=(priority_queue&& __q)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
@@ -520,7 +489,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
@@ -532,7 +501,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
const container_type& __c,
const _Alloc& __a,
@@ -546,7 +515,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
@@ -557,11 +526,11 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue&
_STD::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
container_type&& __c,
const _Alloc& __a,
@@ -573,9 +542,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
_STD::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
@@ -586,10 +556,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
_STD::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
{
@@ -597,10 +567,10 @@ priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
_STD::push_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
{
@@ -608,11 +578,9 @@ priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
_STD::push_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Container, class _Compare>
template <class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
{
@@ -620,11 +588,10 @@ priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
_STD::push_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
priority_queue<_Tp, _Container, _Compare>::pop()
{
@@ -633,7 +600,7 @@ priority_queue<_Tp, _Container, _Compare>::pop()
}
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
{
@@ -643,7 +610,7 @@ priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
}
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(priority_queue<_Tp, _Container, _Compare>& __x,
priority_queue<_Tp, _Container, _Compare>& __y)
@@ -652,7 +619,7 @@ swap(priority_queue<_Tp, _Container, _Compare>& __x,
}
template <class _Tp, class _Container, class _Compare, class _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
struct uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -23,14 +23,13 @@ class ratio
public:
static const intmax_t num;
static const intmax_t den;
typedef ratio<num, den> type;
};
// ratio arithmetic
template <class R1, class R2> using ratio_add = ...;
template <class R1, class R2> using ratio_subtract = ...;
template <class R1, class R2> using ratio_multiply = ...;
template <class R1, class R2> using ratio_divide = ...;
template <class R1, class R2> struct ratio_add;
template <class R1, class R2> struct ratio_subtract;
template <class R1, class R2> struct ratio_multiply;
template <class R1, class R2> struct ratio_divide;
// ratio comparison
template <class R1, class R2> struct ratio_equal;
@@ -221,7 +220,7 @@ public:
};
template <intmax_t _Num, intmax_t _Den = 1>
class _LIBCPP_VISIBLE ratio
class ratio
{
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
static_assert(_Den != 0, "ratio divide by 0");
@@ -261,7 +260,7 @@ typedef ratio< 1000000000000000LL, 1LL> peta;
typedef ratio<1000000000000000000LL, 1LL> exa;
template <class _R1, class _R2>
struct __ratio_multiply
struct ratio_multiply
{
private:
static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
@@ -275,11 +274,7 @@ public:
};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_multiply
: public __ratio_multiply<_R1, _R2>::type {};
template <class _R1, class _R2>
struct __ratio_divide
struct ratio_divide
{
private:
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
@@ -293,11 +288,7 @@ public:
};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_divide
: public __ratio_divide<_R1, _R2>::type {};
template <class _R1, class _R2>
struct __ratio_add
struct ratio_add
{
private:
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
@@ -319,11 +310,7 @@ public:
};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_add
: public __ratio_add<_R1, _R2>::type {};
template <class _R1, class _R2>
struct __ratio_subtract
struct ratio_subtract
{
private:
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
@@ -344,19 +331,15 @@ public:
>::type type;
};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_subtract
: public __ratio_subtract<_R1, _R2>::type {};
// ratio_equal
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_equal
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
struct ratio_equal
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_not_equal
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
struct ratio_not_equal
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
// ratio_less
@@ -414,19 +397,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL>
};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_less
struct ratio_less
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_less_equal
struct ratio_less_equal
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_greater
struct ratio_greater
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_greater_equal
struct ratio_greater_equal
: public integral_constant<bool, !ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>

File diff suppressed because it is too large Load Diff

View File

@@ -1,573 +0,0 @@
// -*- C++ -*-
//===-------------------------- scoped_allocator --------------------------===//
//
// 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_SCOPED_ALLOCATOR
#define _LIBCPP_SCOPED_ALLOCATOR
/*
scoped_allocator synopsis
namespace std
{
template <class OuterAlloc, class... InnerAllocs>
class scoped_allocator_adaptor : public OuterAlloc
{
typedef allocator_traits<OuterAlloc> OuterTraits; // exposition only
scoped_allocator_adaptor<InnerAllocs...> inner; // exposition only
public:
typedef OuterAlloc outer_allocator_type;
typedef see below inner_allocator_type;
typedef typename OuterTraits::value_type value_type;
typedef typename OuterTraits::size_type size_type;
typedef typename OuterTraits::difference_type difference_type;
typedef typename OuterTraits::pointer pointer;
typedef typename OuterTraits::const_pointer const_pointer;
typedef typename OuterTraits::void_pointer void_pointer;
typedef typename OuterTraits::const_void_pointer const_void_pointer;
typedef see below propagate_on_container_copy_assignment;
typedef see below propagate_on_container_move_assignment;
typedef see below propagate_on_container_swap;
template <class Tp>
struct rebind
{
typedef scoped_allocator_adaptor<
OuterTraits::template rebind_alloc<Tp>, InnerAllocs...> other;
};
scoped_allocator_adaptor();
template <class OuterA2>
scoped_allocator_adaptor(OuterA2&& outerAlloc,
const InnerAllocs&... innerAllocs);
scoped_allocator_adaptor(const scoped_allocator_adaptor& other);
template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other);
template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other);
~scoped_allocator_adaptor();
inner_allocator_type& inner_allocator();
const inner_allocator_type& inner_allocator() const;
outer_allocator_type& outer_allocator();
const outer_allocator_type& outer_allocator() const;
pointer allocate(size_type n);
pointer allocate(size_type n, const_void_pointer hint);
void deallocate(pointer p, size_type n);
size_type max_size() const;
template <class T, class... Args> void construct(T* p, Args&& args);
template <class T1, class T2, class... Args1, class... Args2>
void construct(pair<T1, T2>* p, piecewise_construct t, tuple<Args1...> x,
tuple<Args2...> y);
template <class T1, class T2>
void construct(pair<T1, T2>* p);
template <class T1, class T2, class U, class V>
void construct(pair<T1, T2>* p, U&& x, V&& y);
template <class T1, class T2, class U, class V>
void construct(pair<T1, T2>* p, const pair<U, V>& x);
template <class T1, class T2, class U, class V>
void construct(pair<T1, T2>* p, pair<U, V>&& x);
template <class T> void destroy(T* p);
scoped_allocator_adaptor select_on_container_copy_construction() const;
};
template <class OuterA1, class OuterA2, class... InnerAllocs>
bool
operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
template <class OuterA1, class OuterA2, class... InnerAllocs>
bool
operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
} // std
*/
#include <__config>
#include <memory>
#pragma GCC system_header
_LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
// scoped_allocator_adaptor
template <class ..._Allocs>
class scoped_allocator_adaptor;
template <class ..._Allocs> struct __get_poc_copy_assignment;
template <class _A0>
struct __get_poc_copy_assignment<_A0>
{
static const bool value = allocator_traits<_A0>::
propagate_on_container_copy_assignment::value;
};
template <class _A0, class ..._Allocs>
struct __get_poc_copy_assignment<_A0, _Allocs...>
{
static const bool value =
allocator_traits<_A0>::propagate_on_container_copy_assignment::value ||
__get_poc_copy_assignment<_Allocs...>::value;
};
template <class ..._Allocs> struct __get_poc_move_assignment;
template <class _A0>
struct __get_poc_move_assignment<_A0>
{
static const bool value = allocator_traits<_A0>::
propagate_on_container_move_assignment::value;
};
template <class _A0, class ..._Allocs>
struct __get_poc_move_assignment<_A0, _Allocs...>
{
static const bool value =
allocator_traits<_A0>::propagate_on_container_move_assignment::value ||
__get_poc_move_assignment<_Allocs...>::value;
};
template <class ..._Allocs> struct __get_poc_swap;
template <class _A0>
struct __get_poc_swap<_A0>
{
static const bool value = allocator_traits<_A0>::
propagate_on_container_swap::value;
};
template <class _A0, class ..._Allocs>
struct __get_poc_swap<_A0, _Allocs...>
{
static const bool value =
allocator_traits<_A0>::propagate_on_container_swap::value ||
__get_poc_swap<_Allocs...>::value;
};
template <class ..._Allocs>
class __scoped_allocator_storage;
template <class _OuterAlloc, class... _InnerAllocs>
class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
: public _OuterAlloc
{
typedef _OuterAlloc outer_allocator_type;
protected:
typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type;
private:
inner_allocator_type __inner_;
protected:
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs)
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)),
__inner_(__innerAllocs...) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, const _OuterA2&>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other)
: outer_allocator_type(__other.outer_allocator()),
__inner_(__other.inner_allocator()) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other)
: outer_allocator_type(_STD::move(__other.outer_allocator())),
__inner_(_STD::move(__other.inner_allocator())) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __o,
const inner_allocator_type& __i)
: outer_allocator_type(_STD::forward<_OuterA2>(__o)),
__inner_(__i)
{
}
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() {return __inner_;}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const {return __inner_;}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator()
{return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const
{return static_cast<const outer_allocator_type&>(*this);}
scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
_LIBCPP_INLINE_VISIBILITY
select_on_container_copy_construction() const
{
return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
(
allocator_traits<outer_allocator_type>::
select_on_container_copy_construction(outer_allocator()),
allocator_traits<inner_allocator_type>::
select_on_container_copy_construction(inner_allocator())
);
}
template <class...> friend class __scoped_allocator_storage;
};
template <class _OuterAlloc>
class __scoped_allocator_storage<_OuterAlloc>
: public _OuterAlloc
{
typedef _OuterAlloc outer_allocator_type;
protected:
typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc)
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, const _OuterA2&>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2>& __other)
: outer_allocator_type(__other.outer_allocator()) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2>&& __other)
: outer_allocator_type(_STD::move(__other.outer_allocator())) {}
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator()
{return static_cast<inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const
{return static_cast<const inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator()
{return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const
{return static_cast<const outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor<outer_allocator_type>
select_on_container_copy_construction() const
{return scoped_allocator_adaptor<outer_allocator_type>(
allocator_traits<outer_allocator_type>::
select_on_container_copy_construction(outer_allocator())
);}
__scoped_allocator_storage(const outer_allocator_type& __o,
const inner_allocator_type& __i);
template <class...> friend class __scoped_allocator_storage;
};
// __outermost
template <class _Alloc>
decltype(declval<_Alloc>().outer_allocator(), true_type())
__has_outer_allocator_test(_Alloc&& __a);
template <class _Alloc>
false_type
__has_outer_allocator_test(const volatile _Alloc& __a);
template <class _Alloc>
struct __has_outer_allocator
: public common_type
<
decltype(__has_outer_allocator_test(declval<_Alloc&>()))
>::type
{
};
template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
struct __outermost
{
typedef _Alloc type;
_LIBCPP_INLINE_VISIBILITY
type& operator()(type& __a) const {return __a;}
};
template <class _Alloc>
struct __outermost<_Alloc, true>
{
typedef typename remove_reference
<
decltype(_STD::declval<_Alloc>().outer_allocator())
>::type _OuterAlloc;
typedef typename __outermost<_OuterAlloc>::type type;
_LIBCPP_INLINE_VISIBILITY
type& operator()(_Alloc& __a) const
{return __outermost<_OuterAlloc>()(__a.outer_allocator());}
};
template <class _OuterAlloc, class... _InnerAllocs>
class _LIBCPP_VISIBLE scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
{
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
typedef allocator_traits<_OuterAlloc> _OuterTraits;
public:
typedef _OuterAlloc outer_allocator_type;
typedef typename base::inner_allocator_type inner_allocator_type;
typedef typename _OuterTraits::size_type size_type;
typedef typename _OuterTraits::difference_type difference_type;
typedef typename _OuterTraits::pointer pointer;
typedef typename _OuterTraits::const_pointer const_pointer;
typedef typename _OuterTraits::void_pointer void_pointer;
typedef typename _OuterTraits::const_void_pointer const_void_pointer;
typedef integral_constant
<
bool,
__get_poc_copy_assignment<outer_allocator_type,
_InnerAllocs...>::value
> propagate_on_container_copy_assignment;
typedef integral_constant
<
bool,
__get_poc_move_assignment<outer_allocator_type,
_InnerAllocs...>::value
> propagate_on_container_move_assignment;
typedef integral_constant
<
bool,
__get_poc_swap<outer_allocator_type, _InnerAllocs...>::value
> propagate_on_container_swap;
template <class _Tp>
struct rebind
{
typedef scoped_allocator_adaptor
<
typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs...
> other;
};
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor() {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs)
: base(_STD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, const _OuterA2&>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other)
: base(__other) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other)
: base(_STD::move(__other)) {}
// ~scoped_allocator_adaptor() = default;
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator()
{return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const
{return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator()
{return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const
{return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY
pointer allocate(size_type __n)
{return allocator_traits<outer_allocator_type>::
allocate(outer_allocator(), __n);}
_LIBCPP_INLINE_VISIBILITY
pointer allocate(size_type __n, const_void_pointer __hint)
{return allocator_traits<outer_allocator_type>::
allocate(outer_allocator(), __n, __hint);}
_LIBCPP_INLINE_VISIBILITY
void deallocate(pointer __p, size_type __n)
{allocator_traits<outer_allocator_type>::
deallocate(outer_allocator(), __p, __n);}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const
{return allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void construct(_Tp* __p, _Args&& ...__args)
{__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
__p, _STD::forward<_Args>(__args)...);}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
void destroy(_Tp* __p)
{
typedef __outermost<outer_allocator_type> _OM;
allocator_traits<typename _OM::type>::
destroy(_OM()(outer_allocator()), __p);
}
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor select_on_container_copy_construction() const
{return base::select_on_container_copy_construction();}
private:
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __o,
const inner_allocator_type& __i)
: base(_STD::forward<_OuterA2>(__o), __i) {}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void __construct(integral_constant<int, 0>, _Tp* __p, _Args&& ...__args)
{
typedef __outermost<outer_allocator_type> _OM;
allocator_traits<typename _OM::type>::construct
(
_OM()(outer_allocator()),
__p,
_STD::forward<_Args>(__args)...
);
}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void __construct(integral_constant<int, 1>, _Tp* __p, _Args&& ...__args)
{
typedef __outermost<outer_allocator_type> _OM;
allocator_traits<typename _OM::type>::construct
(
_OM()(outer_allocator()),
__p,
allocator_arg,
inner_allocator(),
_STD::forward<_Args>(__args)...
);
}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void __construct(integral_constant<int, 2>, _Tp* __p, _Args&& ...__args)
{
typedef __outermost<outer_allocator_type> _OM;
allocator_traits<typename _OM::type>::construct
(
_OM()(outer_allocator()),
__p,
_STD::forward<_Args>(__args)...,
inner_allocator()
);
}
template <class...> friend class __scoped_allocator_storage;
};
template <class _OuterA1, class _OuterA2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
const scoped_allocator_adaptor<_OuterA2>& __b)
{
return __a.outer_allocator() == __b.outer_allocator();
}
template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b)
{
return __a.outer_allocator() == __b.outer_allocator() &&
__a.inner_allocator() == __b.inner_allocator();
}
template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b)
{
return !(__a == __b);
}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_SCOPED_ALLOCATOR

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -157,6 +157,7 @@ template <class Key, class Compare, class Allocator>
void
swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y);
template <class Key, class Compare = less<Key>,
class Allocator = allocator<Key>>
class multiset
@@ -310,7 +311,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class _LIBCPP_VISIBLE set
class set
{
public:
// types:
@@ -339,14 +340,11 @@ public:
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit set(const value_compare& __comp = value_compare())
: __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY
set(const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
set(_InputIterator __f, _InputIterator __l,
const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -355,7 +353,6 @@ public:
}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
const allocator_type& __a)
: __tree_(__comp, __a)
@@ -363,42 +360,36 @@ public:
insert(__f, __l);
}
_LIBCPP_INLINE_VISIBILITY
set(const set& __s)
: __tree_(__s.__tree_)
{
insert(__s.begin(), __s.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
set(set&& __s)
: __tree_(_STD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY
explicit set(const allocator_type& __a)
: __tree_(__a) {}
_LIBCPP_INLINE_VISIBILITY
set(const set& __s, const allocator_type& __a)
: __tree_(__s.__tree_.value_comp(), __a)
{
insert(__s.begin(), __s.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
set(set&& __s, const allocator_type& __a);
#endif
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp,
const allocator_type& __a)
: __tree_(__comp, __a)
@@ -406,145 +397,103 @@ public:
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
set& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_unique(__il.begin(), __il.end());
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
set& operator=(set&& __s)
{
__tree_ = _STD::move(__s.__tree_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __tree_.max_size();}
// modifiers:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#ifdef _LIBCPP_MOVE
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_Args&&... __args)
{return __tree_.__emplace_unique(_STD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_unique(__p, _STD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
#endif
pair<iterator,bool> insert(const value_type& __v)
{return __tree_.__insert_unique(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
pair<iterator,bool> insert(value_type&& __v)
{return __tree_.__insert_unique(_STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_unique(__p, __v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_unique(__p, _STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
{
for (const_iterator __e = cend(); __f != __l; ++__f)
__tree_.__insert_unique(__e, *__f);
}
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k)
{return __tree_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(set& __s) {__tree_.swap(__s.__tree_);}
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp();}
_LIBCPP_INLINE_VISIBILITY
value_compare value_comp() const {return __tree_.value_comp();}
// set operations:
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_unique(__k);}
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Key, class _Compare, class _Allocator>
set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
@@ -558,10 +507,10 @@ set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator==(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -570,7 +519,7 @@ operator==(const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator< (const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -579,7 +528,7 @@ operator< (const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -588,7 +537,7 @@ operator!=(const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator> (const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -597,7 +546,7 @@ operator> (const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator>=(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -606,7 +555,7 @@ operator>=(const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator<=(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -616,7 +565,7 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x,
// specialized algorithms:
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(set<_Key, _Compare, _Allocator>& __x,
set<_Key, _Compare, _Allocator>& __y)
@@ -624,9 +573,10 @@ swap(set<_Key, _Compare, _Allocator>& __x,
__x.swap(__y);
}
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class _LIBCPP_VISIBLE multiset
class multiset
{
public:
// types:
@@ -656,14 +606,11 @@ public:
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
explicit multiset(const value_compare& __comp = value_compare())
: __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY
multiset(const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l,
const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -672,7 +619,6 @@ public:
}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l,
const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a)
@@ -680,7 +626,6 @@ public:
insert(__f, __l);
}
_LIBCPP_INLINE_VISIBILITY
multiset(const multiset& __s)
: __tree_(__s.__tree_.value_comp(),
__alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
@@ -688,32 +633,27 @@ public:
insert(__s.begin(), __s.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
multiset(multiset&& __s)
: __tree_(_STD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
explicit multiset(const allocator_type& __a)
: __tree_(__a) {}
_LIBCPP_INLINE_VISIBILITY
multiset(const multiset& __s, const allocator_type& __a)
: __tree_(__s.__tree_.value_comp(), __a)
{
insert(__s.begin(), __s.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
multiset(multiset&& __s, const allocator_type& __a);
#endif
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp,
const allocator_type& __a)
: __tree_(__comp, __a)
@@ -721,144 +661,102 @@ public:
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_multi(__il.begin(), __il.end());
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
multiset& operator=(multiset&& __s)
{
__tree_ = _STD::move(__s.__tree_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __tree_.max_size();}
// modifiers:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#ifdef _LIBCPP_MOVE
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_Args&&... __args)
{return __tree_.__emplace_multi(_STD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
#endif
iterator insert(const value_type& __v)
{return __tree_.__insert_multi(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
iterator insert(value_type&& __v)
{return __tree_.__insert_multi(_STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_multi(__p, __v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_multi(_STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
{
for (const_iterator __e = cend(); __f != __l; ++__f)
__tree_.__insert_multi(__e, *__f);
}
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(multiset& __s) {__tree_.swap(__s.__tree_);}
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp();}
_LIBCPP_INLINE_VISIBILITY
value_compare value_comp() const {return __tree_.value_comp();}
// set operations:
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_multi(__k);}
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Key, class _Compare, class _Allocator>
multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
@@ -872,10 +770,10 @@ multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_t
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator==(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -884,7 +782,7 @@ operator==(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator< (const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -893,7 +791,7 @@ operator< (const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -902,7 +800,7 @@ operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator> (const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -911,7 +809,7 @@ operator> (const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -920,7 +818,7 @@ operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -929,7 +827,7 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>& __y)
@@ -937,6 +835,7 @@ swap(multiset<_Key, _Compare, _Allocator>& __x,
__x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_SET

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -182,7 +182,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// basic_stringbuf
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_VISIBLE basic_stringbuf
class basic_stringbuf
: public basic_streambuf<_CharT, _Traits>
{
public:
@@ -206,12 +206,12 @@ public:
explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out);
explicit basic_stringbuf(const string_type& __s,
ios_base::openmode __wch = ios_base::in | ios_base::out);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_stringbuf(basic_stringbuf&& __rhs);
#endif
// 27.8.1.2 Assign and swap:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_stringbuf& operator=(basic_stringbuf&& __rhs);
#endif
void swap(basic_stringbuf& __rhs);
@@ -250,7 +250,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type&
str(__s);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits, class _Allocator>
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
@@ -298,7 +298,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits, class _Allocator>
void
@@ -434,7 +434,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
ptrdiff_t __nout = this->pptr() - this->pbase();
ptrdiff_t __hm = __hm_ - this->pbase();
__str_.push_back(char_type());
@@ -449,9 +449,9 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
{
return traits_type::eof();
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
}
__hm_ = _STD::max(this->pptr() + 1, __hm_);
__hm_ = max(this->pptr() + 1, __hm_);
if (__mode_ & ios_base::in)
{
char_type* __p = const_cast<char_type*>(__str_.data());
@@ -525,7 +525,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
// basic_istringstream
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_VISIBLE basic_istringstream
class basic_istringstream
: public basic_istream<_CharT, _Traits>
{
public:
@@ -546,12 +546,12 @@ public:
explicit basic_istringstream(ios_base::openmode __wch = ios_base::in);
explicit basic_istringstream(const string_type& __s,
ios_base::openmode __wch = ios_base::in);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_istringstream(basic_istringstream&& __rhs);
// 27.8.2.2 Assign and swap:
basic_istringstream& operator=(basic_istringstream&& __rhs);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void swap(basic_istringstream& __rhs);
// 27.8.2.3 Members:
@@ -577,7 +577,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
{
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -597,7 +597,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -644,7 +644,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_ostringstream
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_VISIBLE basic_ostringstream
class basic_ostringstream
: public basic_ostream<_CharT, _Traits>
{
public:
@@ -665,12 +665,12 @@ public:
explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out);
explicit basic_ostringstream(const string_type& __s,
ios_base::openmode __wch = ios_base::out);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_ostringstream(basic_ostringstream&& __rhs);
// 27.8.2.2 Assign and swap:
basic_ostringstream& operator=(basic_ostringstream&& __rhs);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void swap(basic_ostringstream& __rhs);
// 27.8.2.3 Members:
@@ -696,7 +696,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
{
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -716,7 +716,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -763,7 +763,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_stringstream
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_VISIBLE basic_stringstream
class basic_stringstream
: public basic_iostream<_CharT, _Traits>
{
public:
@@ -784,12 +784,12 @@ public:
explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out);
explicit basic_stringstream(const string_type& __s,
ios_base::openmode __wch = ios_base::in | ios_base::out);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
basic_stringstream(basic_stringstream&& __rhs);
// 27.8.2.2 Assign and swap:
basic_stringstream& operator=(basic_stringstream&& __rhs);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
void swap(basic_stringstream& __rhs);
// 27.8.2.3 Members:
@@ -815,7 +815,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
{
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -835,7 +835,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&&
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -92,7 +92,7 @@ bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> >
class _LIBCPP_VISIBLE stack
class stack
{
public:
typedef _Container container_type;
@@ -105,76 +105,54 @@ protected:
container_type c;
public:
_LIBCPP_INLINE_VISIBILITY
stack() : c() {}
_LIBCPP_INLINE_VISIBILITY
explicit stack(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
explicit stack(container_type&& __c) : c(_STD::move(__c)) {}
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __s) : c(_STD::move(__s.c)) {}
_LIBCPP_INLINE_VISIBILITY
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit stack(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(const container_type& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__c, __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(const stack& __s, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__s.c, __a) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__c), __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __s, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__s.c), __a) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return c.size();}
_LIBCPP_INLINE_VISIBILITY
reference top() {return c.back();}
_LIBCPP_INLINE_VISIBILITY
const_reference top() const {return c.back();}
_LIBCPP_INLINE_VISIBILITY
void push(const value_type& __v) {c.push_back(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args)
template <class... _Args> void emplace(_Args&&... __args)
{c.emplace_back(_STD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
void pop() {c.pop_back();}
_LIBCPP_INLINE_VISIBILITY
void swap(stack& __s)
{
using _STD::swap;
@@ -185,7 +163,7 @@ public:
friend
bool
operator==(const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
template <class T1, class _C1>
friend
bool
@@ -193,7 +171,7 @@ public:
};
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -201,7 +179,7 @@ operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -209,7 +187,7 @@ operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -217,7 +195,7 @@ operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -225,7 +203,7 @@ operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -233,7 +211,7 @@ operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -241,7 +219,7 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
{
@@ -249,7 +227,7 @@ swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container, class _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<stack<_Tp, _Container>, _Alloc>
struct uses_allocator<stack<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};

44
include/stdbool.h Normal file
View File

@@ -0,0 +1,44 @@
// -*- C++ -*-
//===--------------------------- stdbool.h --------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_STDBOOL_H
#define _LIBCPP_STDBOOL_H
/*
stdbool.h synopsis
Macros:
__bool_true_false_are_defined
*/
#ifdef __cplusplus
#include <__config>
#endif
#pragma GCC system_header
#undef __bool_true_false_are_defined
#define __bool_true_false_are_defined 1
#ifndef __cplusplus
#define bool _Bool
#if __STDC_VERSION__ < 199901L && __GNUC__ < 3
typedef int _Bool;
#endif
#define false (bool)0
#define true (bool)1
#endif /* !__cplusplus */
#endif // _LIBCPP_STDBOOL_H

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -155,6 +155,7 @@ public:
virtual ~underflow_error() throw();
};
} // std
#endif // _LIBCPP_STDEXCEPT

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -117,7 +117,7 @@ protected:
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_streambuf
class basic_streambuf
{
public:
// types:
@@ -557,6 +557,7 @@ extern template class basic_streambuf<wchar_t>;
extern template class basic_ios<char>;
extern template class basic_ios<wchar_t>;
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STEAMBUF

View File

@@ -71,11 +71,11 @@ struct char_traits
template <> struct char_traits<char>;
template <> struct char_traits<wchar_t>;
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
class basic_string
{
public:
// types:
public:
// types:
typedef traits traits_type;
typedef typename traits_type::char_type value_type;
typedef Allocator allocator_type;
@@ -200,13 +200,13 @@ public:
basic_string& replace(size_type pos, size_type n1, const_pointer s, size_type n2);
basic_string& replace(size_type pos, size_type n1, const_pointer s);
basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s, size_type n);
basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s);
basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
basic_string& replace(iterator i1, iterator i2, const basic_string& str);
basic_string& replace(iterator i1, iterator i2, const_pointer s, size_type n);
basic_string& replace(iterator i1, iterator i2, const_pointer s);
basic_string& replace(iterator i1, iterator i2, size_type n, value_type c);
template<class InputIterator>
basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);
basic_string& replace(iterator i1, iterator i2, InputIterator j1, InputIterator j2);
basic_string& replace(iterator i1, iterator i2, initializer_list<value_type>);
size_type copy(pointer s, size_type n, size_type pos = 0) const;
basic_string substr(size_type pos = 0, size_type n = npos) const;
@@ -290,7 +290,7 @@ bool operator==(const charT* lhs, const basic_string<charT, traits, Allocator>&
template<class charT, class traits, class Allocator>
bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);
template<class charT, class traits, class Allocator>
template<class charT, class traits, class Allocator>
bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
const basic_string<charT, traits, Allocator>& rhs);
@@ -353,7 +353,7 @@ basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const basic_string<charT, traits, Allocator>& str);
template<class charT, class traits, class Allocator>
basic_istream<charT, traits>&
basic_istream<charT, traits>&
getline(basic_istream<charT, traits>& is, basic_string<charT, traits, Allocator>& str,
charT delim);
@@ -442,7 +442,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// fpos
template <class _StateT>
class _LIBCPP_VISIBLE fpos
class fpos
{
private:
_StateT __st_;
@@ -479,7 +479,7 @@ bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
// char_traits
template <class _CharT>
struct _LIBCPP_VISIBLE char_traits
struct char_traits
{
typedef _CharT char_type;
typedef int int_type;
@@ -591,7 +591,7 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
// char_traits<char>
template <>
struct _LIBCPP_VISIBLE char_traits<char>
struct char_traits<char>
{
typedef char char_type;
typedef int int_type;
@@ -628,7 +628,7 @@ struct _LIBCPP_VISIBLE char_traits<char>
// char_traits<wchar_t>
template <>
struct _LIBCPP_VISIBLE char_traits<wchar_t>
struct char_traits<wchar_t>
{
typedef wchar_t char_type;
typedef wint_t int_type;
@@ -665,7 +665,7 @@ struct _LIBCPP_VISIBLE char_traits<wchar_t>
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
template <>
struct _LIBCPP_VISIBLE char_traits<char16_t>
struct char_traits<char16_t>
{
typedef char16_t char_type;
typedef uint_least16_t int_type;
@@ -771,7 +771,7 @@ char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a)
}
template <>
struct _LIBCPP_VISIBLE char_traits<char32_t>
struct char_traits<char32_t>
{
typedef char32_t char_type;
typedef uint_least32_t int_type;
@@ -876,7 +876,7 @@ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a)
return __r;
}
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
#endif
// basic_string
@@ -932,8 +932,8 @@ __basic_string_common<__b>::__throw_out_of_range() const
extern template class __basic_string_common<true>;
template<class _CharT, class _Traits, class _Allocator>
class _LIBCPP_VISIBLE basic_string
template<class _CharT, class _Traits, class _Allocator>
class basic_string
: private __basic_string_common<true>
{
public:
@@ -941,13 +941,12 @@ public:
typedef _Traits traits_type;
typedef typename traits_type::char_type value_type;
typedef _Allocator allocator_type;
typedef allocator_traits<allocator_type> __alloc_traits;
typedef typename __alloc_traits::size_type size_type;
typedef typename __alloc_traits::difference_type difference_type;
typedef typename allocator_type::size_type size_type;
typedef typename allocator_type::difference_type difference_type;
typedef typename allocator_type::reference reference;
typedef typename allocator_type::const_reference const_reference;
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
typedef typename allocator_type::pointer pointer;
typedef typename allocator_type::const_pointer const_pointer;
#ifdef _LIBCPP_DEBUG
typedef __debug_iter<basic_string, pointer> iterator;
typedef __debug_iter<basic_string, const_pointer> const_iterator;
@@ -957,10 +956,10 @@ public:
#elif defined(_LIBCPP_RAW_ITERATORS)
typedef pointer iterator;
typedef const_pointer const_iterator;
#else // defined(_LIBCPP_RAW_ITERATORS)
#else
typedef __wrap_iter<pointer> iterator;
typedef __wrap_iter<const_pointer> const_iterator;
#endif // defined(_LIBCPP_RAW_ITERATORS)
#endif
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
@@ -975,10 +974,10 @@ private:
#if _LIBCPP_BIG_ENDIAN
enum {__short_mask = 0x80};
enum {__long_mask = ~(size_type(~0) >> 1)};
#else // _LIBCPP_BIG_ENDIAN
#else
enum {__short_mask = 0x01};
enum {__long_mask = 0x1};
#endif // _LIBCPP_BIG_ENDIAN
#endif
enum {__mask = size_type(~0) >> 1};
@@ -1028,50 +1027,37 @@ private:
public:
static const size_type npos = -1;
_LIBCPP_INLINE_VISIBILITY basic_string();
_LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a);
basic_string();
explicit basic_string(const allocator_type& __a);
basic_string(const basic_string& __str);
basic_string(const basic_string& __str, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
basic_string(basic_string&& __str);
_LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s);
_LIBCPP_INLINE_VISIBILITY
#endif
basic_string(const_pointer __s);
basic_string(const_pointer __s, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
basic_string(const_pointer __s, size_type __n);
_LIBCPP_INLINE_VISIBILITY
basic_string(const_pointer __s, size_type __n, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
basic_string(size_type __n, value_type __c);
_LIBCPP_INLINE_VISIBILITY
basic_string(size_type __n, value_type __c, const allocator_type& __a);
basic_string(const basic_string& __str, size_type __pos, size_type __n = npos,
const allocator_type& __a = allocator_type());
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
basic_string(_InputIterator __first, _InputIterator __last);
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
basic_string(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
basic_string(initializer_list<value_type> __il, const allocator_type& __a);
~basic_string();
basic_string& operator=(const basic_string& __str);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(basic_string&& __str);
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const basic_string& __str) {return assign(__str);}
#ifdef _LIBCPP_MOVE
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(basic_string&& __str) {swap(__str); return *this;}
#endif
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const_pointer __s) {return assign(__s);}
basic_string& operator=(value_type __c);
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
#ifndef _LIBCPP_DEBUG
@@ -1098,7 +1084,7 @@ public:
_LIBCPP_INLINE_VISIBILITY size_type size() const
{return __is_long() ? __get_long_size() : __get_short_size();}
_LIBCPP_INLINE_VISIBILITY size_type length() const {return size();}
_LIBCPP_INLINE_VISIBILITY size_type max_size() const;
size_type max_size() const;
_LIBCPP_INLINE_VISIBILITY size_type capacity() const
{return (__is_long() ? __get_long_cap() : __min_cap) - 1;}
@@ -1106,9 +1092,7 @@ public:
_LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
void reserve(size_type res_arg = 0);
_LIBCPP_INLINE_VISIBILITY
void shrink_to_fit() {reserve();}
_LIBCPP_INLINE_VISIBILITY
void clear();
_LIBCPP_INLINE_VISIBILITY bool empty() const {return size() == 0;}
@@ -1123,7 +1107,6 @@ public:
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
_LIBCPP_INLINE_VISIBILITY
basic_string& append(const basic_string& __str);
basic_string& append(const basic_string& __str, size_type __pos, size_type __n);
basic_string& append(const_pointer __s, size_type __n);
@@ -1144,18 +1127,15 @@ public:
basic_string&
>::type
append(_ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY
basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
void push_back(value_type __c);
_LIBCPP_INLINE_VISIBILITY
void pop_back();
_LIBCPP_INLINE_VISIBILITY reference front();
_LIBCPP_INLINE_VISIBILITY const_reference front() const;
_LIBCPP_INLINE_VISIBILITY reference back();
_LIBCPP_INLINE_VISIBILITY const_reference back() const;
reference front();
const_reference front() const;
reference back();
const_reference back() const;
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(const basic_string& __str);
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n);
basic_string& assign(const_pointer __s, size_type __n);
@@ -1176,17 +1156,14 @@ public:
basic_string&
>::type
assign(_ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
_LIBCPP_INLINE_VISIBILITY
basic_string& insert(size_type __pos1, const basic_string& __str);
basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n);
basic_string& insert(size_type __pos, const_pointer __s, size_type __n);
basic_string& insert(size_type __pos, const_pointer __s);
basic_string& insert(size_type __pos, size_type __n, value_type __c);
iterator insert(const_iterator __pos, value_type __c);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, size_type __n, value_type __c);
template<class _InputIterator>
typename enable_if
@@ -1203,46 +1180,35 @@ public:
iterator
>::type
insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, initializer_list<value_type> __il)
{return insert(__pos, __il.begin(), __il.end());}
basic_string& erase(size_type __pos = 0, size_type __n = npos);
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __pos);
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2);
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2);
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s);
basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
basic_string& replace(iterator __i1, iterator __i2, const basic_string& __str);
basic_string& replace(iterator __i1, iterator __i2, const_pointer __s, size_type __n);
basic_string& replace(iterator __i1, iterator __i2, const_pointer __s);
basic_string& replace(iterator __i1, iterator __i2, size_type __n, value_type __c);
template<class _InputIterator>
typename enable_if
<
__is_input_iterator<_InputIterator>::value,
basic_string&
>::type
replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
replace(iterator __i1, iterator __i2, _InputIterator __j1, _InputIterator __j2);
basic_string& replace(iterator __i1, iterator __i2, initializer_list<value_type> __il)
{return replace(__i1, __i2, __il.begin(), __il.end());}
size_type copy(pointer __s, size_type __n, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
basic_string substr(size_type __pos = 0, size_type __n = npos) const;
_LIBCPP_INLINE_VISIBILITY
void swap(basic_string& __str);
_LIBCPP_INLINE_VISIBILITY const_pointer c_str() const {return data();}
@@ -1250,67 +1216,51 @@ public:
_LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const {return __alloc();}
_LIBCPP_INLINE_VISIBILITY
size_type find(const basic_string& __str, size_type __pos = 0) const;
size_type find(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find(const_pointer __s, size_type __pos = 0) const;
size_type find(value_type __c, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type rfind(const basic_string& __str, size_type __pos = npos) const;
size_type rfind(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type rfind(const_pointer __s, size_type __pos = npos) const;
size_type rfind(value_type __c, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_of(const basic_string& __str, size_type __pos = 0) const;
size_type find_first_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_of(const_pointer __s, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_of(value_type __c, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const basic_string& __str, size_type __pos = npos) const;
size_type find_last_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const_pointer __s, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(value_type __c, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const;
size_type find_first_not_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(const_pointer __s, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(value_type __c, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const;
size_type find_last_not_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const_pointer __s, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(value_type __c, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
int compare(const basic_string& __str) const;
_LIBCPP_INLINE_VISIBILITY
int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const;
int compare(const_pointer __s) const;
int compare(size_type __pos1, size_type __n1, const_pointer __s) const;
int compare(size_type __pos1, size_type __n1, const_pointer __s, size_type __n2) const;
_LIBCPP_INLINE_VISIBILITY bool __invariants() const;
bool __invariants() const;
private:
_LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __r_.second();}
_LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __r_.second();}
_LIBCPP_INLINE_VISIBILITY bool __is_long() const {return bool(__r_.first().__s.__size_ & __short_mask);}
_LIBCPP_INLINE_VISIBILITY void __set_long() {__r_.first().__s.__size_ &= __short_mask;}
_LIBCPP_INLINE_VISIBILITY void __set_short() {__r_.first().__s.__size_ |= ~__short_mask;}
_LIBCPP_INLINE_VISIBILITY void __set_short_size(size_type __s)
#if _LIBCPP_BIG_ENDIAN
@@ -1359,7 +1309,7 @@ private:
void __init(const_pointer __s, size_type __sz, size_type __reserve);
void __init(const_pointer __s, size_type __sz);
void __init(size_type __n, value_type __c);
template <class _InputIterator>
typename enable_if
<
@@ -1378,58 +1328,15 @@ private:
__init(_ForwardIterator __first, _ForwardIterator __last);
void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
size_type __n_copy, size_type __n_del, size_type __n_add = 0);
size_type __n_copy, size_type __n_del, size_type __n_add = 0);
void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
size_type __n_copy, size_type __n_del,
size_type __n_add, const_pointer __p_new_stuff);
_LIBCPP_INLINE_VISIBILITY
void __erase_to_end(size_type __pos);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string& __str)
{__copy_assign_alloc(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string& __str, true_type)
{
if (__alloc() != __str.__alloc())
{
clear();
shrink_to_fit();
}
__alloc() = __str.__alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string& __str, false_type)
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, false_type);
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, true_type);
#endif
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
{}
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
_LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(size_type);
void __invalidate_all_iterators();
void __invalidate_iterators_past(size_type);
friend basic_string operator+<>(const basic_string&, const basic_string&);
friend basic_string operator+<>(const value_type*, const basic_string&);
@@ -1448,7 +1355,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators()
#ifdef _LIBCPP_DEBUG
iterator::__remove_all(this);
const_iterator::__remove_all(this);
#endif // _LIBCPP_DEBUG
#endif
}
template <class _CharT, class _Traits, class _Allocator>
@@ -1488,7 +1395,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
__p = __p->__next;
}
}
#endif // _LIBCPP_DEBUG
#endif
}
template <class _CharT, class _Traits, class _Allocator>
@@ -1521,7 +1428,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _
else
{
size_type __cap = __recommend(__reserve);
__p = __alloc_traits::allocate(__alloc(), __cap+1);
__p = __alloc().allocate(__cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
__set_long_size(__sz);
@@ -1545,7 +1452,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _
else
{
size_type __cap = __recommend(__sz);
__p = __alloc_traits::allocate(__alloc(), __cap+1);
__p = __alloc().allocate(__cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
__set_long_size(__sz);
@@ -1598,7 +1505,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
: __r_(__alloc_traits::select_on_container_copy_construction(__str.__alloc()))
: __r_(__str.__alloc())
{
if (!__str.__is_long())
__r_.first().__r = __str.__r_.first().__r;
@@ -1616,7 +1523,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
__init(__str.__get_long_pointer(), __str.__get_long_size());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
@@ -1632,19 +1539,15 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
: __r_(__a)
: __r_(__str.__r_.first(), __a)
{
if (__a == __str.__alloc() || !__str.__is_long())
__r_.first().__r = __str.__r_.first().__r;
else
__init(__str.__get_long_pointer(), __str.__get_long_size());
__str.__zero();
#ifdef _LIBCPP_DEBUG
__str.__invalidate_all_iterators();
#endif
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_MOVE
template <class _CharT, class _Traits, class _Allocator>
void
@@ -1661,7 +1564,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
else
{
size_type __cap = __recommend(__n);
__p = __alloc_traits::allocate(__alloc(), __cap+1);
__p = __alloc().allocate(__cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
__set_long_size(__n);
@@ -1685,6 +1588,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_typ
__init(__n, __c);
}
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, size_type __n,
const allocator_type& __a)
@@ -1710,7 +1614,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _Input
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
for (; __first != __last; ++__first)
push_back(*__first);
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1718,10 +1622,10 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _Input
catch (...)
{
if (__is_long())
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
__alloc().deallocate(__get_long_pointer(), __get_long_cap());
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
}
template <class _CharT, class _Traits, class _Allocator>
@@ -1745,7 +1649,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For
else
{
size_type __cap = __recommend(__sz);
__p = __alloc_traits::allocate(__alloc(), __cap+1);
__p = __alloc().allocate(__cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
__set_long_size(__sz);
@@ -1789,11 +1693,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_t
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>::~basic_string()
{
__invalidate_all_iterators();
if (__is_long())
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
__alloc().deallocate(__get_long_pointer(), __get_long_cap());
}
template <class _CharT, class _Traits, class _Allocator>
@@ -1809,7 +1714,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
size_type __cap = __old_cap < __ms / 2 - __alignment ?
__recommend(_STD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
__ms - 1;
pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
pointer __p = __alloc().allocate(__cap+1);
__invalidate_all_iterators();
if (__n_copy != 0)
traits_type::copy(__p, __old_p, __n_copy);
@@ -1819,7 +1724,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
if (__sec_cp_sz != 0)
traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
if (__old_cap+1 != __min_cap)
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
__alloc().deallocate(__old_p, __old_cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
__old_sz = __n_copy + __n_add + __sec_cp_sz;
@@ -1839,7 +1744,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
size_type __cap = __old_cap < __ms / 2 - __alignment ?
__recommend(_STD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
__ms - 1;
pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
pointer __p = __alloc().allocate(__cap+1);
__invalidate_all_iterators();
if (__n_copy != 0)
traits_type::copy(__p, __old_p, __n_copy);
@@ -1847,7 +1752,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
if (__sec_cp_sz != 0)
traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
if (__old_cap+1 != __min_cap)
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
__alloc().deallocate(__old_p, __old_cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
}
@@ -1918,54 +1823,6 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
return *this;
}
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
{
if (this != &__str)
{
__copy_assign_alloc(__str);
assign(__str);
}
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
{
if (__alloc() != __str.__alloc())
assign(__str);
else
__move_assign(__str, true_type());
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
{
clear();
shrink_to_fit();
__r_ = _STD::move(__str.__r_);
__str.__zero();
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
{
__move_assign(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());
return *this;
}
#endif
template <class _CharT, class _Traits, class _Allocator>
template<class _InputIterator>
typename enable_if
@@ -2447,7 +2304,7 @@ typename enable_if
__is_input_iterator<_InputIterator>::value,
basic_string<_CharT, _Traits, _Allocator>&
>::type
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
_InputIterator __j1, _InputIterator __j2)
{
for (; true; ++__i1, ++__j1)
@@ -2463,7 +2320,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
erase(__i1, __i2);
break;
}
traits_type::assign(const_cast<value_type&>(*__i1), *__j1);
traits_type::assign(*__i1, *__j1);
}
return *this;
}
@@ -2500,7 +2357,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str)
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const basic_string& __str)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1),
__str.data(), __str.size());
@@ -2509,7 +2366,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n)
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const_pointer __s, size_type __n)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n);
}
@@ -2517,7 +2374,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s)
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const_pointer __s)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s);
}
@@ -2525,7 +2382,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c)
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, size_type __n, value_type __c)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c);
}
@@ -2652,7 +2509,7 @@ _LIBCPP_INLINE_VISIBILITY inline
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::max_size() const
{
size_type __m = __alloc_traits::max_size(__alloc());
size_type __m = __alloc().max_size();
#if _LIBCPP_BIG_ENDIAN
return (__m <= ~__long_mask ? __m : __m/2) - 1;
#else
@@ -2684,24 +2541,24 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
else
{
if (__res_arg > __cap)
__new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
__new_data = __alloc().allocate(__res_arg+1);
else
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
__new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
#endif
__new_data = __alloc().allocate(__res_arg+1);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
return;
}
#else // _LIBCPP_NO_EXCEPTIONS
#else
if (__new_data == 0)
return;
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
}
__now_long = true;
__was_long = __is_long();
@@ -2709,7 +2566,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
}
traits_type::copy(__new_data, __p, size()+1);
if (__was_long)
__alloc_traits::deallocate(__alloc(), __p, __cap+1);
__alloc().deallocate(__p, __cap+1);
if (__now_long)
{
__set_long_cap(__res_arg+1);
@@ -2831,12 +2688,11 @@ _LIBCPP_INLINE_VISIBILITY inline
void
basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
{
_STD::swap(__r_.first(), __str.__r_.first());
__swap_alloc(__alloc(), __str.__alloc());
__r_.swap(__str.__r_);
#ifdef _LIBCPP_DEBUG
__invalidate_all_iterators();
__str.__invalidate_all_iterators();
#endif // _LIBCPP_DEBUG
#endif
}
// find
@@ -3251,7 +3107,6 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type _
// __invariants
template<class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
basic_string<_CharT, _Traits, _Allocator>::__invariants() const
{
@@ -3327,7 +3182,7 @@ operator==(const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __lhs,
// operator!=
template<class _CharT, class _Traits, class _Allocator>
template<class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
@@ -3571,7 +3426,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)
return __r;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template<class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
@@ -3631,7 +3486,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs)
return _STD::move(__lhs);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_MOVE
// swap
@@ -3643,12 +3498,16 @@ swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Tra
__lhs.swap(__rhs);
}
template<class _CharT, class _Traits, class _Allocator>
struct __is_zero_default_constructible<basic_string<_CharT, _Traits, _Allocator> >
: public integral_constant<bool, __is_zero_default_constructible<_Allocator>::value> {};
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef basic_string<char16_t> u16string;
typedef basic_string<char32_t> u32string;
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
#endif
int stoi (const string& __str, size_t* __idx = 0, int __base = 10);
long stol (const string& __str, size_t* __idx = 0, int __base = 10);
@@ -3695,7 +3554,7 @@ template<class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::npos;
template<class _CharT, class _Traits, class _Allocator>
struct _LIBCPP_VISIBLE hash<basic_string<_CharT, _Traits, _Allocator> >
struct hash<basic_string<_CharT, _Traits, _Allocator> >
: public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>
{
size_t
@@ -3763,12 +3622,12 @@ extern template
extern template
enable_if<__is_input_iterator<char const*>::value, string&>::type
string::
replace<char const*>(string::const_iterator, string::const_iterator, char const*, char const*);
replace<char const*>(string::iterator, string::iterator, char const*, char const*);
extern template
enable_if<__is_input_iterator<wchar_t const*>::value, wstring&>::type
wstring::
replace<wchar_t const*>(wstring::const_iterator, wstring::const_iterator, wchar_t const*, wchar_t const*);
replace<wchar_t const*>(wstring::iterator, wstring::iterator, wchar_t const*, wchar_t const*);
extern template
enable_if<__is_forward_iterator<wchar_t*>::value, wstring&>::type

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -135,7 +135,7 @@ private:
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_VISIBLE strstreambuf
class strstreambuf
: public streambuf
{
public:
@@ -149,10 +149,10 @@ public:
strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0);
strstreambuf(const unsigned char* __gnext, streamsize __n);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
strstreambuf(strstreambuf&& __rhs);
strstreambuf& operator=(strstreambuf&& __rhs);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
virtual ~strstreambuf();
@@ -187,25 +187,20 @@ private:
void __init(char* __gnext, streamsize __n, char* __pbeg);
};
class _LIBCPP_VISIBLE istrstream
class istrstream
: public istream
{
public:
_LIBCPP_INLINE_VISIBILITY
explicit istrstream(const char* __s)
: istream(&__sb_), __sb_(__s, 0) {}
_LIBCPP_INLINE_VISIBILITY
explicit istrstream(char* __s)
: istream(&__sb_), __sb_(__s, 0) {}
_LIBCPP_INLINE_VISIBILITY
istrstream(const char* __s, streamsize __n)
: istream(&__sb_), __sb_(__s, __n) {}
_LIBCPP_INLINE_VISIBILITY
istrstream(char* __s, streamsize __n)
: istream(&__sb_), __sb_(__s, __n) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
istrstream(istrstream&& __rhs)
: istream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
@@ -213,48 +208,41 @@ public:
istream::set_rdbuf(&__sb_);
}
_LIBCPP_INLINE_VISIBILITY
istrstream& operator=(istrstream&& __rhs)
{
istream::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
virtual ~istrstream();
_LIBCPP_INLINE_VISIBILITY
void swap(istrstream& __rhs)
{
istream::swap(__rhs);
__sb_.swap(__rhs.__sb_);
}
_LIBCPP_INLINE_VISIBILITY
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
_LIBCPP_INLINE_VISIBILITY
char *str() {return __sb_.str();}
private:
strstreambuf __sb_;
};
class _LIBCPP_VISIBLE ostrstream
class ostrstream
: public ostream
{
public:
_LIBCPP_INLINE_VISIBILITY
ostrstream()
: ostream(&__sb_) {}
_LIBCPP_INLINE_VISIBILITY
ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
: ostream(&__sb_),
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
ostrstream(ostrstream&& __rhs)
: ostream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
@@ -262,38 +250,32 @@ public:
ostream::set_rdbuf(&__sb_);
}
_LIBCPP_INLINE_VISIBILITY
ostrstream& operator=(ostrstream&& __rhs)
{
ostream::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
virtual ~ostrstream();
_LIBCPP_INLINE_VISIBILITY
void swap(ostrstream& __rhs)
{
ostream::swap(__rhs);
__sb_.swap(__rhs.__sb_);
}
_LIBCPP_INLINE_VISIBILITY
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
_LIBCPP_INLINE_VISIBILITY
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
_LIBCPP_INLINE_VISIBILITY
char* str() {return __sb_.str();}
_LIBCPP_INLINE_VISIBILITY
int pcount() const {return __sb_.pcount();}
private:
strstreambuf __sb_; // exposition only
};
class _LIBCPP_VISIBLE strstream
class strstream
: public iostream
{
public:
@@ -304,17 +286,14 @@ public:
typedef char_traits<char>::off_type off_type;
// constructors/destructor
_LIBCPP_INLINE_VISIBILITY
strstream()
: iostream(&__sb_) {}
_LIBCPP_INLINE_VISIBILITY
strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
: iostream(&__sb_),
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
strstream(strstream&& __rhs)
: iostream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
@@ -322,18 +301,16 @@ public:
iostream::set_rdbuf(&__sb_);
}
_LIBCPP_INLINE_VISIBILITY
strstream& operator=(strstream&& __rhs)
{
iostream::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
virtual ~strstream();
_LIBCPP_INLINE_VISIBILITY
void swap(strstream& __rhs)
{
iostream::swap(__rhs);
@@ -341,13 +318,9 @@ public:
}
// Members:
_LIBCPP_INLINE_VISIBILITY
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
_LIBCPP_INLINE_VISIBILITY
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
_LIBCPP_INLINE_VISIBILITY
int pcount() const {return __sb_.pcount();}
_LIBCPP_INLINE_VISIBILITY
char* str() {return __sb_.str();}
private:

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -229,19 +229,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// is_error_code_enum
template <class _Tp>
struct _LIBCPP_VISIBLE is_error_code_enum
template <class _Tp> struct is_error_code_enum
: public false_type {};
// is_error_condition_enum
template <class _Tp>
struct _LIBCPP_VISIBLE is_error_condition_enum
template <class _Tp> struct is_error_condition_enum
: public false_type {};
// Some error codes are not present on all platforms, so we provide equivalents
// for them:
//enum class errc
struct errc
{
@@ -286,30 +281,18 @@ enum _ {
no_child_process = ECHILD,
no_link = ENOLINK,
no_lock_available = ENOLCK,
#ifdef ENODATA
no_message_available = ENODATA,
#else
no_message_available = ENOMSG,
#endif
no_message = ENOMSG,
no_protocol_option = ENOPROTOOPT,
no_space_on_device = ENOSPC,
#ifdef ENOSR
no_stream_resources = ENOSR,
#else
no_stream_resources = ENOMEM,
#endif
no_such_device_or_address = ENXIO,
no_such_device = ENODEV,
no_such_file_or_directory = ENOENT,
no_such_process = ESRCH,
not_a_directory = ENOTDIR,
not_a_socket = ENOTSOCK,
#ifdef ENOSTR
not_a_stream = ENOSTR,
#else
not_a_stream = EINVAL,
#endif
not_connected = ENOTCONN,
not_enough_memory = ENOMEM,
not_supported = ENOTSUP,
@@ -327,11 +310,7 @@ enum _ {
resource_unavailable_try_again = EAGAIN,
result_out_of_range = ERANGE,
state_not_recoverable = ENOTRECOVERABLE,
#ifdef ETIME
stream_timeout = ETIME,
#else
stream_timeout = ETIMEDOUT,
#endif
text_file_busy = ETXTBSY,
timed_out = ETIMEDOUT,
too_many_files_open_in_system = ENFILE,
@@ -344,19 +323,15 @@ enum _ {
_ __v_;
_LIBCPP_ALWAYS_INLINE
errc(_ __v) : __v_(__v) {}
_LIBCPP_ALWAYS_INLINE
operator int() const {return __v_;}
};
template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
template <> struct is_error_condition_enum<errc>
: true_type { };
template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
template <> struct is_error_condition_enum<errc::_>
: true_type { };
class error_condition;
@@ -366,7 +341,7 @@ class error_code;
class __do_message;
class _LIBCPP_VISIBLE error_category
class error_category
{
public:
virtual ~error_category();
@@ -405,7 +380,7 @@ public:
const error_category& generic_category();
const error_category& system_category();
class _LIBCPP_VISIBLE error_condition
class error_condition
{
int __val_;
const error_category* __cat_;
@@ -475,7 +450,7 @@ operator<(const error_condition& __x, const error_condition& __y)
// error_code
class _LIBCPP_VISIBLE error_code
class error_code
{
int __val_;
const error_category* __cat_;
@@ -594,10 +569,9 @@ bool
operator!=(const error_condition& __x, const error_condition& __y) {return !(__x == __y);}
template <>
struct _LIBCPP_VISIBLE hash<error_code>
struct hash<error_code>
: public unary_function<error_code, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const error_code& __ec) const
{
return static_cast<size_t>(__ec.value());
@@ -606,7 +580,7 @@ struct _LIBCPP_VISIBLE hash<error_code>
// system_error
class _LIBCPP_VISIBLE system_error
class system_error
: public runtime_error
{
error_code __ec_;

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -15,7 +15,7 @@
thread synopsis
#define __STDCPP_THREADS__ __cplusplus
#define __STDCPP_THREADS __cplusplus
namespace std
{
@@ -95,82 +95,14 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <system_error>
#include <chrono>
#include <__mutex_base>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#include <pthread.h>
#pragma GCC system_header
#define __STDCPP_THREADS__ __cplusplus
#define __STDCPP_THREADS __cplusplus
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
class __thread_specific_ptr
{
pthread_key_t __key_;
__thread_specific_ptr(const __thread_specific_ptr&);
__thread_specific_ptr& operator=(const __thread_specific_ptr&);
static void __at_thread_exit(void*);
public:
typedef _Tp* pointer;
__thread_specific_ptr();
~__thread_specific_ptr();
_LIBCPP_INLINE_VISIBILITY
pointer get() const {return static_cast<_Tp*>(pthread_getspecific(__key_));}
_LIBCPP_INLINE_VISIBILITY
pointer operator*() const {return *get();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return get();}
pointer release();
void reset(pointer __p = nullptr);
};
template <class _Tp>
void
__thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
{
delete static_cast<pointer>(__p);
}
template <class _Tp>
__thread_specific_ptr<_Tp>::__thread_specific_ptr()
{
int __ec = pthread_key_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
if (__ec)
throw system_error(error_code(__ec, system_category()),
"__thread_specific_ptr construction failed");
}
template <class _Tp>
__thread_specific_ptr<_Tp>::~__thread_specific_ptr()
{
pthread_key_delete(__key_);
}
template <class _Tp>
typename __thread_specific_ptr<_Tp>::pointer
__thread_specific_ptr<_Tp>::release()
{
pointer __p = get();
pthread_setspecific(__key_, 0);
return __p;
}
template <class _Tp>
void
__thread_specific_ptr<_Tp>::reset(pointer __p)
{
pointer __p_old = get();
pthread_setspecific(__key_, __p);
delete __p_old;
}
class thread;
class __thread_id;
@@ -181,7 +113,7 @@ __thread_id get_id();
} // this_thread
class _LIBCPP_VISIBLE __thread_id
class __thread_id
{
// FIXME: pthread_t is a pointer on Darwin but a long on Linux.
// NULL is the no-thread value on Darwin. Someone needs to check
@@ -189,50 +121,40 @@ class _LIBCPP_VISIBLE __thread_id
pthread_t __id_;
public:
_LIBCPP_INLINE_VISIBILITY
__thread_id() : __id_(0) {}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(__thread_id __x, __thread_id __y)
friend bool operator==(__thread_id __x, __thread_id __y)
{return __x.__id_ == __y.__id_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(__thread_id __x, __thread_id __y)
friend bool operator!=(__thread_id __x, __thread_id __y)
{return !(__x == __y);}
friend _LIBCPP_INLINE_VISIBILITY
bool operator< (__thread_id __x, __thread_id __y)
friend bool operator< (__thread_id __x, __thread_id __y)
{return __x.__id_ < __y.__id_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator<=(__thread_id __x, __thread_id __y)
friend bool operator<=(__thread_id __x, __thread_id __y)
{return !(__y < __x);}
friend _LIBCPP_INLINE_VISIBILITY
bool operator> (__thread_id __x, __thread_id __y)
friend bool operator> (__thread_id __x, __thread_id __y)
{return __y < __x ;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator>=(__thread_id __x, __thread_id __y)
friend bool operator>=(__thread_id __x, __thread_id __y)
{return !(__x < __y);}
template<class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id)
{return __os << __id.__id_;}
private:
_LIBCPP_INLINE_VISIBILITY
__thread_id(pthread_t __id) : __id_(__id) {}
friend __thread_id this_thread::get_id();
friend class _LIBCPP_VISIBLE thread;
friend class thread;
};
template<class _Tp> struct hash;
template<>
struct _LIBCPP_VISIBLE hash<__thread_id>
struct hash<__thread_id>
: public unary_function<__thread_id, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(__thread_id __v) const
{
const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
@@ -243,7 +165,7 @@ struct _LIBCPP_VISIBLE hash<__thread_id>
namespace this_thread
{
inline _LIBCPP_INLINE_VISIBILITY
inline
__thread_id
get_id()
{
@@ -252,17 +174,18 @@ get_id()
} // this_thread
class _LIBCPP_VISIBLE thread
class thread
{
pthread_t __t_;
thread(const thread&);
thread& operator=(const thread&);
#ifndef _LIBCPP_MOVE
thread(const thread&); // = delete;
thread& operator=(const thread&); // = delete;
#endif
public:
typedef __thread_id id;
typedef pthread_t native_handle_type;
_LIBCPP_INLINE_VISIBILITY
thread() : __t_(0) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args,
@@ -272,81 +195,48 @@ public:
>::type
>
explicit thread(_F&& __f, _Args&&... __args);
#else // _LIBCPP_HAS_NO_VARIADICS
#else
template <class _F> explicit thread(_F __f);
#endif
~thread();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
thread(const thread&) = delete;
thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;}
thread& operator=(const thread&) = delete;
thread& operator=(thread&& __t);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(thread& __t) {_STD::swap(__t_, __t.__t_);}
_LIBCPP_INLINE_VISIBILITY
bool joinable() const {return __t_ != 0;}
void join();
void detach();
_LIBCPP_INLINE_VISIBILITY
id get_id() const {return __t_;}
_LIBCPP_INLINE_VISIBILITY
native_handle_type native_handle() {return __t_;}
static unsigned hardware_concurrency();
};
class __assoc_sub_state;
class _LIBCPP_HIDDEN __thread_struct_imp;
class __thread_struct
{
__thread_struct_imp* __p_;
__thread_struct(const __thread_struct&);
__thread_struct& operator=(const __thread_struct&);
public:
__thread_struct();
~__thread_struct();
void notify_all_at_thread_exit(condition_variable*, mutex*);
void __make_ready_at_thread_exit(__assoc_sub_state*);
};
__thread_specific_ptr<__thread_struct>& __thread_local_data();
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args, size_t ..._Indices>
inline _LIBCPP_INLINE_VISIBILITY
void
__threaad_execute(tuple<_F, _Args...>& __t, __tuple_indices<_Indices...>)
{
__invoke(_STD::move(_STD::get<0>(__t)), _STD::move(_STD::get<_Indices>(__t))...);
}
template <class _F>
void*
__thread_proxy(void* __vp)
{
__thread_local_data().reset(new __thread_struct);
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
__threaad_execute(*__p, _Index());
(*__p)();
return nullptr;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args,
class
>
thread::thread(_F&& __f, _Args&&... __args)
{
typedef tuple<typename decay<_F>::type, typename decay<_Args>::type...> _G;
_STD::unique_ptr<_G> __p(new _G(__decay_copy(_STD::forward<_F>(__f)),
__decay_copy(_STD::forward<_Args>(__args))...));
typedef decltype(bind(std::forward<_F>(__f), std::forward<_Args>(__args)...)) _G;
std::unique_ptr<_G> __p(new _G(bind(std::forward<_F>(__f),
std::forward<_Args>(__args)...)));
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
if (__ec == 0)
__p.release();
@@ -354,17 +244,7 @@ thread::thread(_F&& __f, _Args&&... __args)
__throw_system_error(__ec, "thread constructor failed");
}
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _F>
void*
__thread_proxy(void* __vp)
{
__thread_local_data().reset(new __thread_struct);
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
(*__p)();
return nullptr;
}
#else
template <class _F>
thread::thread(_F __f)
@@ -377,11 +257,11 @@ thread::thread(_F __f)
__throw_system_error(__ec, "thread constructor failed");
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
inline _LIBCPP_INLINE_VISIBILITY
inline
thread&
thread::operator=(thread&& __t)
{
@@ -392,11 +272,12 @@ thread::operator=(thread&& __t)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
inline _LIBCPP_INLINE_VISIBILITY
inline
void swap(thread& __x, thread& __y) {__x.swap(__y);}
namespace this_thread
{
@@ -426,15 +307,15 @@ sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
}
template <class _Duration>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
sleep_until(const chrono::time_point<chrono::monotonic_clock, _Duration>& __t)
{
using namespace chrono;
sleep_for(__t - steady_clock::now());
sleep_for(__t - monotonic_clock::now());
}
inline _LIBCPP_INLINE_VISIBILITY
inline
void yield() {sched_yield();}
} // this_thread

View File

@@ -72,10 +72,12 @@ public:
const unspecified ignore;
template <class... T> tuple<V...> make_tuple(T&&...);
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...);
template <class... T> tuple<T&...> tie(T&...);
template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls);
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, const tuple<U...>&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, const tuple<U...>&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, tuple<U...>&&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, tuple<U...>&&);
// 20.4.1.4, tuple helper classes:
template <class T> class tuple_size; // undefined
template <class... T> class tuple_size<tuple<T...>>;
@@ -85,7 +87,6 @@ template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
// 20.4.1.5, element access:
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type& get(tuple<T...>&);
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type const& get(const tuple<T...>&);
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type&& get(tuple<T...>&&);
// 20.4.1.6, relational operators:
template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&);
@@ -101,6 +102,12 @@ template <class... Types, class Alloc>
template <class... Types>
void swap(tuple<Types...>& x, tuple<Types...>& y);
template <class InputIterator>
InputIterator begin(const std::tuple<InputIterator, InputIterator>& t);
template <class InputIterator>
InputIterator end(const std::tuple<InputIterator, InputIterator>& t);
} // std
*/
@@ -120,7 +127,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// tuple_size
template <class ..._Tp>
class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...> >
class tuple_size<tuple<_Tp...>>
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
template <class ..._Tp>
class tuple_size<const tuple<_Tp...>>
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
@@ -128,10 +141,17 @@ class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...> >
// tuple_element
template <size_t _Ip, class ..._Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, tuple<_Tp...> >
class tuple_element<_Ip, tuple<_Tp...>>
{
public:
typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
typedef typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
};
template <size_t _Ip, class ..._Tp>
class tuple_element<_Ip, const tuple<_Tp...>>
{
public:
typedef const typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
};
// __tuple_leaf
@@ -140,7 +160,7 @@ template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value>
class __tuple_leaf;
template <size_t _Ip, class _Hp, bool _Ep>
inline _LIBCPP_INLINE_VISIBILITY
inline
void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
{
swap(__x.get(), __y.get());
@@ -178,21 +198,18 @@ public:
{static_assert(!is_reference<_Hp>::value,
"Attempted to default construct a reference element in a tuple");}
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(_Tp&& __t)
: value(_STD::forward<_Tp>(__t))
{static_assert(!is_reference<_Hp>::value ||
{static_assert(!is_lvalue_reference<_Hp>::value ||
is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type,
reference_wrapper<
typename remove_reference<_Hp>::type
>
>::value) ||
(is_rvalue_reference<_Hp>::value &&
!is_lvalue_reference<_Tp>::value),
>::value),
"Attempted to construct a reference element in a tuple with an rvalue");}
template <class _Tp, class _Alloc>
@@ -237,10 +254,6 @@ public:
>::value),
"Attempted to construct a reference element in a tuple with an rvalue");}
__tuple_leaf(const __tuple_leaf& __t)
: value(__t.get())
{static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
@@ -289,8 +302,7 @@ public:
__tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
: _Hp(__a) {}
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(_Tp&& __t)
: _Hp(_STD::forward<_Tp>(__t)) {}
@@ -334,9 +346,7 @@ public:
_LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return static_cast<const _Hp&>(*this);}
};
template <class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
void __swallow(_Tp&&...) {}
template <class ..._Tp> void __swallow(_Tp&&...) {}
// __tuple_impl
@@ -348,7 +358,6 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
{
template <size_t ..._Uf, class ..._Tf,
size_t ..._Ul, class ..._Tl, class ..._Up>
_LIBCPP_INLINE_VISIBILITY
explicit
__tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
__tuple_indices<_Ul...>, __tuple_types<_Tl...>,
@@ -359,7 +368,6 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <class _Alloc, size_t ..._Uf, class ..._Tf,
size_t ..._Ul, class ..._Tl, class ..._Up>
_LIBCPP_INLINE_VISIBILITY
explicit
__tuple_impl(allocator_arg_t, const _Alloc& __a,
__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
@@ -373,10 +381,9 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <class _Tuple,
class = typename enable_if
<
__tuple_convertible<_Tuple, tuple<_Tp...> >::value
__tuple_convertible<_Tuple, tuple<_Tp...>>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
__tuple_impl(_Tuple&& __t)
: __tuple_leaf<_Indx, _Tp>(_STD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_STD::get<_Indx>(__t)))...
@@ -385,22 +392,20 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <class _Alloc, class _Tuple,
class = typename enable_if
<
__tuple_convertible<_Tuple, tuple<_Tp...> >::value
__tuple_convertible<_Tuple, tuple<_Tp...>>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
__tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
: __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(), __a,
typename __make_tuple_types<_Tuple>::type>::type>(), __a,
_STD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_STD::get<_Indx>(__t)))...
{}
template <class _Tuple>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
__tuple_assignable<_Tuple, tuple<_Tp...> >::value,
__tuple_assignable<_Tuple, tuple<_Tp...>>::value,
__tuple_impl&
>::type
operator=(_Tuple&& __t)
@@ -410,7 +415,6 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
return *this;
}
_LIBCPP_INLINE_VISIBILITY
void swap(__tuple_impl& __t)
{
__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
@@ -418,21 +422,18 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
};
template <class ..._Tp>
class _LIBCPP_VISIBLE tuple
class tuple
{
typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> base;
base base_;
template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&);
typename tuple_element<_Jp, tuple<_Up...>>::type& get(tuple<_Up...>&);
template <size_t _Jp, class ..._Up> friend
const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&);
template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&);
const typename tuple_element<_Jp, tuple<_Up...>>::type& get(const tuple<_Up...>&);
public:
_LIBCPP_INLINE_VISIBILITY
explicit tuple(const _Tp& ... __t)
: base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
@@ -442,7 +443,6 @@ public:
) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
: base_(allocator_arg_t(), __a,
typename __make_tuple_indices<sizeof...(_Tp)>::type(),
@@ -466,7 +466,6 @@ public:
>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
explicit
tuple(_Up&&... __u)
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
@@ -489,7 +488,6 @@ public:
>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
: base_(allocator_arg_t(), __a,
typename __make_tuple_indices<sizeof...(_Up)>::type(),
@@ -504,7 +502,6 @@ public:
__tuple_convertible<_Tuple, tuple>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple(_Tuple&& __t)
: base_(_STD::forward<_Tuple>(__t)) {}
@@ -514,7 +511,6 @@ public:
__tuple_convertible<_Tuple, tuple>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
: base_(allocator_arg_t(), __a, _STD::forward<_Tuple>(__t)) {}
@@ -524,7 +520,6 @@ public:
__tuple_assignable<_Tuple, tuple>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple&
operator=(_Tuple&& __t)
{
@@ -532,29 +527,22 @@ public:
return *this;
}
_LIBCPP_INLINE_VISIBILITY
void swap(tuple& __t) {base_.swap(__t.base_);}
};
template <>
class _LIBCPP_VISIBLE tuple<>
class tuple<>
{
public:
_LIBCPP_INLINE_VISIBILITY
tuple() {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&, const tuple&) {}
template <class _U>
_LIBCPP_INLINE_VISIBILITY
tuple(array<_U, 0>) {}
template <class _Alloc, class _U>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&, array<_U, 0>) {}
_LIBCPP_INLINE_VISIBILITY
void swap(tuple&) {}
};
@@ -566,37 +554,27 @@ swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) {__t.swap(__u);}
// get
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&
inline
typename tuple_element<_Ip, tuple<_Tp...>>::type&
get(tuple<_Tp...>& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get();
}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
inline
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
get(const tuple<_Tp...>& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<type&&>(
static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
}
// tie
template <class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
tuple<_Tp&...>
tie(_Tp&... __t)
{
@@ -606,13 +584,10 @@ tie(_Tp&... __t)
template <class _Up>
struct __ignore_t
{
_LIBCPP_INLINE_VISIBILITY
__ignore_t() {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
__ignore_t(_Tp&&) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
const __ignore_t& operator=(_Tp&&) const {return *this;}
};
@@ -627,7 +602,7 @@ struct ___make_tuple_return
};
template <class _Tp>
struct ___make_tuple_return<reference_wrapper<_Tp> >
struct ___make_tuple_return<reference_wrapper<_Tp>>
{
typedef _Tp& type;
};
@@ -639,26 +614,17 @@ struct __make_tuple_return
};
template <class... _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
tuple<typename __make_tuple_return<_Tp>::type...>
make_tuple(_Tp&&... __t)
{
return tuple<typename __make_tuple_return<_Tp>::type...>(_STD::forward<_Tp>(__t)...);
}
template <class... _Tp>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp&&...>
forward_as_tuple(_Tp&&... __t)
{
return tuple<_Tp&&...>(_STD::forward<_Tp>(__t)...);
}
template <size_t _I>
struct __tuple_equal
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Up& __y)
{
return __tuple_equal<_I - 1>()(__x, __y) && get<_I-1>(__x) == get<_I-1>(__y);
@@ -669,7 +635,6 @@ template <>
struct __tuple_equal<0>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp&, const _Up&)
{
return true;
@@ -677,7 +642,7 @@ struct __tuple_equal<0>
};
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -685,7 +650,7 @@ operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -696,7 +661,6 @@ template <size_t _I>
struct __tuple_less
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Up& __y)
{
return __tuple_less<_I-1>()(__x, __y) ||
@@ -708,7 +672,6 @@ template <>
struct __tuple_less<0>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp&, const _Up&)
{
return false;
@@ -716,7 +679,7 @@ struct __tuple_less<0>
};
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -724,7 +687,7 @@ operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -732,7 +695,7 @@ operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -740,7 +703,7 @@ operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -749,146 +712,94 @@ operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
// tuple_cat
template <class _Tp, class _Up> struct __tuple_cat_type;
template <class ..._Ttypes, class ..._Utypes>
struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
{
typedef tuple<_Ttypes..., _Utypes...> type;
};
template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
struct __tuple_cat_return_1
{
};
template <class ..._Types, class _Tuple0>
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
{
typedef typename __tuple_cat_type<tuple<_Types...>,
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type
type;
};
template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_1<
typename __tuple_cat_type<
tuple<_Types...>,
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type
>::type,
__tuple_like<typename remove_reference<_Tuple1>::type>::value,
_Tuple1, _Tuples...>
{
};
template <class ..._Tuples> struct __tuple_cat_return;
template <class _Tuple0, class ..._Tuples>
struct __tuple_cat_return<_Tuple0, _Tuples...>
: public __tuple_cat_return_1<tuple<>,
__tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0,
_Tuples...>
{
};
template <>
struct __tuple_cat_return<>
{
typedef tuple<> type;
};
inline _LIBCPP_INLINE_VISIBILITY
tuple<>
tuple_cat()
{
return tuple<>();
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., get<_I2>(__y)...);
}
template <class _R, class _Indices, class _Tuple0, class ..._Tuples>
struct __tuple_cat_return_ref_imp;
template <class ..._Types, size_t ..._I0, class _Tuple0>
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
typedef typename remove_reference<_Tuple0>::type _T0;
typedef tuple<_Types..., typename __apply_cv<_Tuple0,
typename tuple_element<_I0, _T0>::type>::type&&...> type;
};
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
_Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_ref_imp<
tuple<_Types..., typename __apply_cv<_Tuple0,
typename tuple_element<_I0,
typename remove_reference<_Tuple0>::type>::type>::type&&...>,
typename __make_tuple_indices<tuple_size<typename
remove_reference<_Tuple1>::type>::value>::type,
_Tuple1, _Tuples...>
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
{
};
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., get<_I2>(__y)...);
}
template <class _Tuple0, class ..._Tuples>
struct __tuple_cat_return_ref
: public __tuple_cat_return_ref_imp<tuple<>,
typename __make_tuple_indices<
tuple_size<typename remove_reference<_Tuple0>::type>::value
>::type, _Tuple0, _Tuples...>
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(tuple<_Tp...>&& __x, const tuple<_Up...>& __y)
{
};
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class _Types, class _I0, class _J0>
struct __tuple_cat;
template <class ..._Types, size_t ..._I0, size_t ..._J0>
struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> >
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
{
template <class _Tuple0>
_LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
operator()(tuple<_Types...> __t, _Tuple0&& __t0)
{
return _STD::forward_as_tuple(_STD::forward<_Types>(get<_I0>(__t))...,
get<_J0>(_STD::forward<_Tuple0>(__t0))...);
}
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., _STD::forward<_Up>(get<_I2>(__y))...);
}
template <class _Tuple0, class _Tuple1, class ..._Tuples>
_LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
{
typedef typename remove_reference<_Tuple0>::type _T0;
typedef typename remove_reference<_Tuple1>::type _T1;
return __tuple_cat<
tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
typename __make_tuple_indices<tuple_size<_T1>::value>::type>()
(_STD::forward_as_tuple(
_STD::forward<_Types>(get<_I0>(__t))...,
get<_J0>(_STD::forward<_Tuple0>(__t0))...
),
_STD::forward<_Tuple1>(__t1),
_STD::forward<_Tuples>(__tpls)...);
}
};
template <class _Tuple0, class... _Tuples>
inline _LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return<_Tuple0, _Tuples...>::type
tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(const tuple<_Tp...>& __x, tuple<_Up...>&& __y)
{
typedef typename remove_reference<_Tuple0>::type _T0;
return __tuple_cat<tuple<>, __tuple_indices<>,
typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
(tuple<>(), _STD::forward<_Tuple0>(__t0),
_STD::forward<_Tuples>(__tpls)...);
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
{
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., _STD::forward<_Up>(get<_I2>(__y))...);
}
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(tuple<_Tp...>&& __x, tuple<_Up...>&& __y)
{
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class ..._Tp, class _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<tuple<_Tp...>, _Alloc>
struct uses_allocator<tuple<_Tp...>, _Alloc>
: true_type {};
template <class _InputIterator>
inline
_InputIterator
begin(const std::tuple<_InputIterator, _InputIterator>& __t)
{
return get<0>(__t);
}
template <class _InputIterator>
inline
_InputIterator
end(const std::tuple<_InputIterator, _InputIterator>& __t)
{
return get<1>(__t);
}
template <class _T1, class _T2>
template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -900,7 +811,7 @@ pair<_T1, _T2>::pair(piecewise_construct_t,
{
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif
_LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -53,39 +53,29 @@ struct hash<type_index>
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_VISIBLE type_index
class type_index
{
const type_info* __t_;
public:
_LIBCPP_INLINE_VISIBILITY
type_index(const type_info& __y) : __t_(&__y) {}
_LIBCPP_INLINE_VISIBILITY
bool operator==(const type_index& __y) const {return *__t_ == *__y.__t_;}
_LIBCPP_INLINE_VISIBILITY
bool operator!=(const type_index& __y) const {return *__t_ != *__y.__t_;}
_LIBCPP_INLINE_VISIBILITY
bool operator< (const type_index& __y) const {return __t_->before(*__y.__t_);}
_LIBCPP_INLINE_VISIBILITY
bool operator<=(const type_index& __y) const {return !__y.__t_->before(*__t_);}
_LIBCPP_INLINE_VISIBILITY
bool operator> (const type_index& __y) const {return __y.__t_->before(*__t_);}
_LIBCPP_INLINE_VISIBILITY
bool operator>=(const type_index& __y) const {return !__t_->before(*__y.__t_);}
_LIBCPP_INLINE_VISIBILITY
size_t hash_code() const {return __t_->hash_code();}
_LIBCPP_INLINE_VISIBILITY
const char* name() const {return __t_->name();}
};
template <class _Tp> struct _LIBCPP_VISIBLE hash;
template <class _Tp> struct hash;
template <>
struct _LIBCPP_VISIBLE hash<type_index>
struct hash<type_index>
: public unary_function<type_index, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(type_index __index) const {return __index.hash_code();}
};

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,14 +21,14 @@ class type_info
{
public:
virtual ~type_info();
bool operator==(const type_info& rhs) const;
bool operator!=(const type_info& rhs) const;
bool before(const type_info& rhs) const;
size_t hash_code() const throw();
const char* name() const;
type_info(const type_info& rhs) = delete;
type_info& operator=(const type_info& rhs) = delete;
};
@@ -63,44 +63,39 @@ public:
#pragma GCC system_header
namespace std // purposefully not using versioning namespace
{
class _LIBCPP_EXCEPTION_ABI type_info
class _LIBCPP_EXCEPTION_ABI type_info
{
type_info& operator=(const type_info&);
type_info(const type_info&);
protected:
const char* __type_name;
_LIBCPP_INLINE_VISIBILITY
explicit type_info(const char* __n)
: __type_name(__n) {}
public:
virtual ~type_info();
_LIBCPP_INLINE_VISIBILITY
const char* name() const {return __type_name;}
_LIBCPP_INLINE_VISIBILITY
bool before(const type_info& __arg) const
{return __type_name < __arg.__type_name;}
_LIBCPP_INLINE_VISIBILITY
size_t hash_code() const throw()
{return *reinterpret_cast<const size_t*>(&__type_name);}
_LIBCPP_INLINE_VISIBILITY
bool operator==(const type_info& __arg) const
{return __type_name == __arg.__type_name;}
_LIBCPP_INLINE_VISIBILITY
bool operator!=(const type_info& __arg) const
{return !operator==(__arg);}
};
class _LIBCPP_EXCEPTION_ABI bad_cast
: public exception
: public exception
{
public:
bad_cast() throw();
@@ -109,7 +104,7 @@ public:
};
class _LIBCPP_EXCEPTION_ABI bad_typeid
: public exception
: public exception
{
public:
bad_typeid() throw();
@@ -117,6 +112,9 @@ public:
virtual const char* what() const throw();
};
} // std
#endif // __LIBCPP_TYPEINFO

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -288,16 +288,11 @@ class __unordered_map_hasher
: private _Hash
{
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_hasher() : _Hash() {}
_LIBCPP_INLINE_VISIBILITY
__unordered_map_hasher(const _Hash& __h) : _Hash(__h) {}
_LIBCPP_INLINE_VISIBILITY
const _Hash& hash_function() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _Tp& __x) const
{return static_cast<const _Hash&>(*this)(__x.first);}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const typename _Tp::first_type& __x) const
{return static_cast<const _Hash&>(*this)(__x);}
};
@@ -307,16 +302,11 @@ class __unordered_map_hasher<_Tp, _Hash, false>
{
_Hash __hash_;
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_hasher() : __hash_() {}
_LIBCPP_INLINE_VISIBILITY
__unordered_map_hasher(const _Hash& __h) : __hash_(__h) {}
_LIBCPP_INLINE_VISIBILITY
const _Hash& hash_function() const {return __hash_;}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _Tp& __x) const
{return __hash_(__x.first);}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const typename _Tp::first_type& __x) const
{return __hash_(__x);}
};
@@ -326,23 +316,16 @@ class __unordered_map_equal
: private _Pred
{
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_equal() : _Pred() {}
_LIBCPP_INLINE_VISIBILITY
__unordered_map_equal(const _Pred& __p) : _Pred(__p) {}
_LIBCPP_INLINE_VISIBILITY
const _Pred& key_eq() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x,
bool operator()(const typename _Tp::first_type& __x,
const typename _Tp::first_type& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y);}
};
@@ -352,22 +335,15 @@ class __unordered_map_equal<_Tp, _Pred, false>
{
_Pred __pred_;
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_equal() : __pred_() {}
_LIBCPP_INLINE_VISIBILITY
__unordered_map_equal(const _Pred& __p) : __pred_(__p) {}
_LIBCPP_INLINE_VISIBILITY
const _Pred& key_eq() const {return __pred_;}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __pred_(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
{return __pred_(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
{return __pred_(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x,
const typename _Tp::first_type& __y) const
{return __pred_(__x, __y);}
@@ -393,15 +369,13 @@ public:
bool __first_constructed;
bool __second_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_map_node_destructor(allocator_type& __na)
: __na_(__na),
__first_constructed(false),
__second_constructed(false)
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -409,8 +383,7 @@ public:
{
__x.__value_constructed = false;
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#else
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -418,22 +391,21 @@ public:
{
const_cast<bool&>(__x.__value_constructed) = false;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__second_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
};
template <class _HashIterator>
class _LIBCPP_VISIBLE __hash_map_iterator
class __hash_map_iterator
{
_HashIterator __i_;
@@ -453,20 +425,14 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator(_HashIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator operator++(int)
{
__hash_map_iterator __t(*this);
@@ -474,22 +440,20 @@ public:
return __t;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
friend bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
friend bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
template <class, class, class, class, class> friend class unordered_map;
template <class, class, class, class, class> friend class unordered_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_const_local_iterator;
template <class> friend class __hash_map_const_iterator;
};
template <class _HashIterator>
class _LIBCPP_VISIBLE __hash_map_const_iterator
class __hash_map_const_iterator
{
_HashIterator __i_;
@@ -509,24 +473,17 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator(
__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
: __i_(__i.__i_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator operator++(int)
{
__hash_map_const_iterator __t(*this);
@@ -534,22 +491,20 @@ public:
return __t;
}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
friend bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
friend bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class, class, class, class, class> friend class unordered_map;
template <class, class, class, class, class> friend class unordered_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_const_local_iterator;
};
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_VISIBLE unordered_map
class unordered_map
{
public:
// types
@@ -598,7 +553,6 @@ public:
typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
_LIBCPP_INLINE_VISIBILITY
unordered_map() {} // = default;
explicit unordered_map(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -619,10 +573,10 @@ public:
explicit unordered_map(const allocator_type& __a);
unordered_map(const unordered_map& __u);
unordered_map(const unordered_map& __u, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
unordered_map(unordered_map&& __u);
unordered_map(unordered_map&& __u, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
unordered_map(initializer_list<value_type> __il);
unordered_map(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
@@ -631,187 +585,131 @@ public:
const allocator_type& __a);
// ~unordered_map() = default;
// unordered_map& operator=(const unordered_map& __u) = default;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
unordered_map& operator=(unordered_map&& __u);
#endif
unordered_map& operator=(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __table_.end();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
pair<iterator, bool> emplace()
{return __table_.__emplace_unique();}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_A0&& __a0)
{return __table_.__emplace_unique(_STD::forward<_A0>(__a0));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class... _Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
pair<iterator, bool> emplace(_A0&& __a0, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator)
{return __table_.__emplace_unique().first;}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator, _A0&& __a0)
{return __table_.__emplace_unique(_STD::forward<_A0>(__a0)).first;}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class... _Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator, _A0&& __a0, _Args&&... __args)
{return emplace(_STD::forward<_A0>(__a0),
_STD::forward<_Args>(__args)...).first;}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(_P&& __x)
{return __table_.__insert_unique(_STD::forward<_P>(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
iterator insert(const_iterator, const value_type& __x)
{return insert(__x).first;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, _P&& __x)
{return insert(_STD::forward<_P>(__x)).first;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last)
{return __table_.erase(__first.__i_, __last.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(unordered_map& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_function() const
{return __table_.hash_function().hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const
{return __table_.key_eq().key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
mapped_type& operator[](const key_type& __k);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
mapped_type& operator[](key_type&& __k);
#endif
mapped_type& at(const key_type& __k);
const mapped_type& at(const key_type& __k) const;
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_size(size_type __n) const
{return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
_LIBCPP_INLINE_VISIBILITY
local_iterator begin(size_type __n) {return __table_.begin(__n);}
_LIBCPP_INLINE_VISIBILITY
local_iterator end(size_type __n) {return __table_.end(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
float load_factor() const {return __table_.load_factor();}
_LIBCPP_INLINE_VISIBILITY
float max_load_factor() const {return __table_.max_load_factor();}
_LIBCPP_INLINE_VISIBILITY
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
_LIBCPP_INLINE_VISIBILITY
void rehash(size_type __n) {__table_.rehash(__n);}
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
private:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class _A0, class... _Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
__node_holder __construct_node(_A0&& __a0, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
__node_holder __construct_node(_A0&& __a0);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
__node_holder __construct_node(const key_type& __k);
#endif
};
@@ -834,7 +732,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
const allocator_type& __a)
: __table_(__a)
@@ -889,10 +787,10 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
unordered_map&& __u)
: __table_(_STD::move(__u.__table_))
@@ -914,7 +812,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
@@ -943,10 +841,10 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
insert(__il.begin(), __il.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
{
@@ -954,10 +852,10 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
initializer_list<value_type> __il)
@@ -966,8 +864,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0, class... _Args,
@@ -979,17 +876,15 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first),
__node_traits::construct(__na, addressof(__h->__value_.first),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second),
__node_traits::construct(__na, addressof(__h->__value_.second),
_STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0,
class // = typename enable_if<is_convertible<_A0, value_type>::value>::type
@@ -999,15 +894,13 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_),
__node_traits::construct(__na, addressof(__h->__value_),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
return __h;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0, class... _Args,
class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
@@ -1023,8 +916,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_A0&& __a0, _Args&&... _
return __r;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
@@ -1032,18 +924,18 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type&
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__node_traits::construct(__na, addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _STD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -1065,7 +957,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
return __r.first->second;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
_Tp&
@@ -1080,7 +972,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k)
return __r.first->second;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
_Tp&
@@ -1090,7 +982,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k)
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__i == end())
throw out_of_range("unordered_map::at: key not found");
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __i->second;
}
@@ -1102,12 +994,12 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__i == end())
throw out_of_range("unordered_map::at: key not found");
#endif // _LIBCPP_NO_EXCEPTIONS
#endif
return __i->second;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -1135,7 +1027,7 @@ operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -1145,7 +1037,7 @@ operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_VISIBLE unordered_multimap
class unordered_multimap
{
public:
// types
@@ -1192,7 +1084,6 @@ public:
typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
_LIBCPP_INLINE_VISIBILITY
unordered_multimap() {} // = default
explicit unordered_multimap(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -1213,10 +1104,10 @@ public:
explicit unordered_multimap(const allocator_type& __a);
unordered_multimap(const unordered_multimap& __u);
unordered_multimap(const unordered_multimap& __u, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
unordered_multimap(unordered_multimap&& __u);
unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
unordered_multimap(initializer_list<value_type> __il);
unordered_multimap(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(),
@@ -1226,173 +1117,120 @@ public:
const allocator_type& __a);
// ~unordered_multimap() = default;
// unordered_multimap& operator=(const unordered_multimap& __u) = default;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
unordered_multimap& operator=(unordered_multimap&& __u);
#endif
unordered_multimap& operator=(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __table_.end();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
iterator emplace()
{return __table_.__emplace_multi();}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_A0&& __a0)
{return __table_.__emplace_multi(_STD::forward<_A0>(__a0));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class... _Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
iterator emplace(_A0&& __a0, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p)
{return __table_.__emplace_hint_multi(__p.__i_);}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _A0&& __a0)
{return __table_.__emplace_hint_multi(__p.__i_, _STD::forward<_A0>(__a0));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class... _Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
iterator emplace_hint(const_iterator __p, _A0&& __a0, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(_P&& __x)
{return __table_.__insert_multi(_STD::forward<_P>(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
iterator insert(const_iterator __p, const value_type& __x)
{return __table_.__insert_multi(__p.__i_, __x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, _P&& __x)
{return __table_.__insert_multi(__p.__i_, _STD::forward<_P>(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last)
{return __table_.erase(__first.__i_, __last.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(unordered_multimap& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_function() const
{return __table_.hash_function().hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const
{return __table_.key_eq().key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_size(size_type __n) const
{return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
_LIBCPP_INLINE_VISIBILITY
local_iterator begin(size_type __n) {return __table_.begin(__n);}
_LIBCPP_INLINE_VISIBILITY
local_iterator end(size_type __n) {return __table_.end(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
float load_factor() const {return __table_.load_factor();}
_LIBCPP_INLINE_VISIBILITY
float max_load_factor() const {return __table_.max_load_factor();}
_LIBCPP_INLINE_VISIBILITY
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
_LIBCPP_INLINE_VISIBILITY
void rehash(size_type __n) {__table_.rehash(__n);}
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
private:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#ifdef _LIBCPP_MOVE
template <class _A0, class... _Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
__node_holder __construct_node(_A0&& __a0, _Args&&... __args);
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
__node_holder __construct_node(_A0&& __a0);
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#endif
};
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -1442,8 +1280,9 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
insert(__first, __last);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
const allocator_type& __a)
: __table_(__a)
@@ -1468,10 +1307,10 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
unordered_multimap&& __u)
: __table_(_STD::move(__u.__table_))
@@ -1495,7 +1334,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
@@ -1524,10 +1363,10 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
insert(__il.begin(), __il.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u)
{
@@ -1535,10 +1374,10 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multima
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
initializer_list<value_type> __il)
@@ -1547,8 +1386,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0, class... _Args,
@@ -1560,17 +1398,15 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first),
__node_traits::construct(__na, addressof(__h->__value_.first),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second),
__node_traits::construct(__na, addressof(__h->__value_.second),
_STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0,
class // = typename enable_if<is_convertible<_A0, value_type>::value>::type
@@ -1580,15 +1416,13 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_),
__node_traits::construct(__na, addressof(__h->__value_),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
return __h;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _A0, class... _Args,
class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
@@ -1618,12 +1452,11 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace_hint(
return __r;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -1633,7 +1466,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __fir
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -1665,7 +1498,7 @@ operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -271,7 +271,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_VISIBLE unordered_set
class unordered_set
{
public:
// types
@@ -299,7 +299,6 @@ public:
typedef typename __table::const_local_iterator local_iterator;
typedef typename __table::const_local_iterator const_local_iterator;
_LIBCPP_INLINE_VISIBILITY
unordered_set() {} // = default;
explicit unordered_set(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -318,10 +317,10 @@ public:
explicit unordered_set(const allocator_type& __a);
unordered_set(const unordered_set& __u);
unordered_set(const unordered_set& __u, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
unordered_set(unordered_set&& __u);
unordered_set(unordered_set&& __u, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
unordered_set(initializer_list<value_type> __il);
unordered_set(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(),
@@ -331,130 +330,86 @@ public:
const allocator_type& __a);
// ~unordered_set() = default;
// unordered_set& operator=(const unordered_set& __u) = default;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
unordered_set& operator=(unordered_set&& __u);
#endif
unordered_set& operator=(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __table_.end();}
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#ifdef _LIBCPP_MOVE
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_Args&&... __args)
{return __table_.__emplace_unique(_STD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator, _Args&&... __args)
{return __table_.__emplace_unique(_STD::forward<_Args>(__args)...).first;}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
#endif
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
pair<iterator, bool> insert(value_type&& __x)
{return __table_.__insert_unique(_STD::move(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#endif
iterator insert(const_iterator, const value_type& __x)
{return insert(__x).first;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
iterator insert(const_iterator, value_type&& __x)
{return insert(_STD::move(__x)).first;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last)
{return __table_.erase(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(unordered_set& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_function() const {return __table_.hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const {return __table_.key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
_LIBCPP_INLINE_VISIBILITY
local_iterator begin(size_type __n) {return __table_.begin(__n);}
_LIBCPP_INLINE_VISIBILITY
local_iterator end(size_type __n) {return __table_.end(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
float load_factor() const {return __table_.load_factor();}
_LIBCPP_INLINE_VISIBILITY
float max_load_factor() const {return __table_.max_load_factor();}
_LIBCPP_INLINE_VISIBILITY
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
_LIBCPP_INLINE_VISIBILITY
void rehash(size_type __n) {__table_.rehash(__n);}
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
};
@@ -505,7 +460,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
const allocator_type& __a)
: __table_(__a)
@@ -530,10 +485,10 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
unordered_set&& __u)
: __table_(_STD::move(__u.__table_))
@@ -553,7 +508,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
@@ -582,10 +537,10 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
insert(__il.begin(), __il.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_set<_Value, _Hash, _Pred, _Alloc>&
unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
{
@@ -593,10 +548,10 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_set<_Value, _Hash, _Pred, _Alloc>&
unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
initializer_list<value_type> __il)
@@ -607,7 +562,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -617,7 +572,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -645,7 +600,7 @@ operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -655,7 +610,7 @@ operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_VISIBLE unordered_multiset
class unordered_multiset
{
public:
// types
@@ -683,7 +638,6 @@ public:
typedef typename __table::const_local_iterator local_iterator;
typedef typename __table::const_local_iterator const_local_iterator;
_LIBCPP_INLINE_VISIBILITY
unordered_multiset() {} // = default
explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -702,10 +656,10 @@ public:
explicit unordered_multiset(const allocator_type& __a);
unordered_multiset(const unordered_multiset& __u);
unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
unordered_multiset(unordered_multiset&& __u);
unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
unordered_multiset(initializer_list<value_type> __il);
unordered_multiset(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(),
@@ -715,128 +669,84 @@ public:
const allocator_type& __a);
// ~unordered_multiset() = default;
// unordered_multiset& operator=(const unordered_multiset& __u) = default;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
unordered_multiset& operator=(unordered_multiset&& __u);
#endif
unordered_multiset& operator=(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __table_.end();}
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#ifdef _LIBCPP_MOVE
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_Args&&... __args)
{return __table_.__emplace_multi(_STD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __table_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
#endif
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
iterator insert(value_type&& __x) {return __table_.__insert_multi(_STD::move(__x));}
#endif
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __x)
{return __table_.__insert_multi(__p, __x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_MOVE
iterator insert(const_iterator __p, value_type&& __x)
{return __table_.__insert_multi(__p, _STD::move(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last)
{return __table_.erase(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(unordered_multiset& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_function() const {return __table_.hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const {return __table_.key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
_LIBCPP_INLINE_VISIBILITY
local_iterator begin(size_type __n) {return __table_.begin(__n);}
_LIBCPP_INLINE_VISIBILITY
local_iterator end(size_type __n) {return __table_.end(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
float load_factor() const {return __table_.load_factor();}
_LIBCPP_INLINE_VISIBILITY
float max_load_factor() const {return __table_.max_load_factor();}
_LIBCPP_INLINE_VISIBILITY
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
_LIBCPP_INLINE_VISIBILITY
void rehash(size_type __n) {__table_.rehash(__n);}
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
};
@@ -888,7 +798,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
const allocator_type& __a)
: __table_(__a)
@@ -913,10 +823,10 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
insert(__u.begin(), __u.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
unordered_multiset&& __u)
: __table_(_STD::move(__u.__table_))
@@ -936,7 +846,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
@@ -965,10 +875,10 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
insert(__il.begin(), __il.end());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
unordered_multiset&& __u)
@@ -977,7 +887,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
@@ -991,7 +901,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -1001,7 +911,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -1033,7 +943,7 @@ operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)

View File

@@ -3,8 +3,8 @@
//
// 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.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -38,7 +38,7 @@ template <class T> typename remove_reference<T>::type&& move(T&&);
template <class T>
typename conditional
<
!is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value,
!has_nothrow_move_constructor<T>::value && has_copy_constructor<T>::value,
const T&,
T&&
>::type
@@ -100,9 +100,10 @@ template<size_t I, class T1, class T2>
const typename const tuple_element<I, std::pair<T1, T2> >::type&
get(const std::pair<T1, T2>&);
template<size_t I, class T1, class T2>
typename tuple_element<I, std::pair<T1, T2> >::type&&
get(std::pair<T1, T2>&&);
template <class InputIterator>
InputIterator begin(const std::pair<InputIterator, InputIterator>& p);
template <class InputIterator>
InputIterator end(const std::pair<InputIterator, InputIterator>& p);
} // std
@@ -175,14 +176,14 @@ swap(_Tp (&__a)[_N], _Tp (&__b)[_N])
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
typename conditional
<
!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value,
!has_nothrow_move_constructor<_Tp>::value && has_copy_constructor<_Tp>::value,
const _Tp&,
_Tp&&
>::type
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
const _Tp&
#endif
move_if_noexcept(_Tp& __x)
@@ -190,7 +191,7 @@ move_if_noexcept(_Tp& __x)
return _STD::move(__x);
}
struct _LIBCPP_VISIBLE piecewise_construct_t { };
struct piecewise_construct_t { };
//constexpr
extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
@@ -198,7 +199,7 @@ template <class _T1, class _T2> struct pair;
template <class _T1, class _T2> void swap(pair<_T1, _T2>&, pair<_T1, _T2>&);
template <class _T1, class _T2>
struct _LIBCPP_VISIBLE pair
struct pair
{
typedef _T1 first_type;
typedef _T2 second_type;
@@ -211,14 +212,7 @@ struct _LIBCPP_VISIBLE pair
_LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y)
: first(__x), second(__y) {}
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(const pair<_U1, _U2>& __p,
typename enable_if<is_convertible<_U1, _T1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0)
: first(__p.first), second(__p.second) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _U1, class _U2,
class = typename enable_if<is_convertible<_U1, first_type >::value &&
@@ -229,16 +223,6 @@ struct _LIBCPP_VISIBLE pair
second(_STD::forward<_U2>(__u2))
{}
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(pair<_U1, _U2>&& __p,
typename enable_if<is_convertible<_U1, _T1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0)
: first(_STD::forward<_U1>(__p.first)),
second(_STD::forward<_U2>(__p.second)) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template<class _Tuple,
class = typename enable_if<__tuple_convertible<_Tuple, pair>::value>::type>
_LIBCPP_INLINE_VISIBILITY
@@ -249,20 +233,18 @@ struct _LIBCPP_VISIBLE pair
typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p)))
{}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
_LIBCPP_INLINE_VISIBILITY
pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
tuple<_Args2...> __second_args)
: pair(__pc, __first_args, __second_args,
: pair(__pc, __first_args, __second_args,
typename __make_tuple_indices<sizeof...(_Args1)>::type(),
typename __make_tuple_indices<sizeof...(_Args2) >::type())
{}
#endif
template <class _Tuple,
class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair&
operator=(_Tuple&& __p)
{
@@ -274,19 +256,20 @@ struct _LIBCPP_VISIBLE pair
return *this;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)
: first(__p.first), second(__p.second) {}
#endif
void _LIBCPP_INLINE_VISIBILITY swap(pair& __p) {_STD::swap(*this, __p);}
private:
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
_LIBCPP_INLINE_VISIBILITY
pair(piecewise_construct_t,
tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
__tuple_indices<_I1...>, __tuple_indices<_I2...>);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif
};
template <class _T1, class _T2>
@@ -346,7 +329,7 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
swap(__x.second, __y.second);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifdef _LIBCPP_MOVE
template <class _Tp> class reference_wrapper;
@@ -369,7 +352,7 @@ struct __make_pair_return
};
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
inline
pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type>
make_pair(_T1&& __t1, _T2&& __t2)
{
@@ -377,7 +360,7 @@ make_pair(_T1&& __t1, _T2&& __t2)
(_STD::forward<_T1>(__t1), _STD::forward<_T2>(__t2));
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -387,41 +370,39 @@ make_pair(_T1 __x, _T2 __y)
return pair<_T1, _T2>(__x, __y);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_size<pair<_T1, _T2> >
: public integral_constant<size_t, 2> {};
class tuple_size<pair<_T1, _T2> > : public integral_constant<size_t, 2> {};
template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_size<const pair<_T1, _T2> >
: public integral_constant<size_t, 2> {};
class tuple_size<const pair<_T1, _T2> > : public integral_constant<size_t, 2> {};
template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_element<0, pair<_T1, _T2> >
class tuple_element<0, pair<_T1, _T2> >
{
public:
typedef _T1 type;
};
template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_element<1, pair<_T1, _T2> >
class tuple_element<1, pair<_T1, _T2> >
{
public:
typedef _T2 type;
};
template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_element<0, const pair<_T1, _T2> >
class tuple_element<0, const pair<_T1, _T2> >
{
public:
typedef const _T1 type;
};
template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_element<1, const pair<_T1, _T2> >
class tuple_element<1, const pair<_T1, _T2> >
{
public:
typedef const _T2 type;
@@ -443,16 +424,6 @@ struct __get_pair<0>
_LIBCPP_INLINE_VISIBILITY
const _T1&
get(const pair<_T1, _T2>& __p) {return __p.first;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY
_T1&&
get(pair<_T1, _T2>&& __p) {return _STD::forward<_T1>(__p.first);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
template <>
@@ -469,16 +440,6 @@ struct __get_pair<1>
_LIBCPP_INLINE_VISIBILITY
const _T2&
get(const pair<_T1, _T2>& __p) {return __p.second;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY
_T2&&
get(pair<_T1, _T2>&& __p) {return _STD::forward<_T2>(__p.second);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
template <size_t _Ip, class _T1, class _T2>
@@ -497,19 +458,23 @@ get(const pair<_T1, _T2>& __p)
return __get_pair<_Ip>::get(__p);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
template <size_t _Ip, class _T1, class _T2>
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY inline
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&& __p)
_InputIterator
begin(const pair<_InputIterator, _InputIterator>& __p)
{
return __get_pair<_Ip>::get(_STD::move(__p));
return __p.first;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY inline
_InputIterator
end(const pair<_InputIterator, _InputIterator>& __p)
{
return __p.second;
}
_LIBCPP_END_NAMESPACE_STD

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