Compare commits

..

4 Commits

Author SHA1 Message Date
Dave Zarzycki
f4f572688f "Tagging libcpp-25.1 from https://llvm.org/svn/llvm-project/libcxx/branches/apple25"
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/tags/libcpp-25.1@136661 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01 23:13:22 +00:00
Howard Hinnant
474be15134 Correct spelling _LIBCPP_STABLE_APPLE_ABI
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple25@136614 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01 13:39:41 +00:00
Howard Hinnant
fbb2b54c17 branch off of libcpp-25
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple25@136613 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01 13:34:00 +00:00
Howard Hinnant
0e1f6f5856 Tagging 25
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/tags/libcpp-25@135270 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 13:52:54 +00:00
1971 changed files with 16492 additions and 80394 deletions

View File

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

View File

@@ -14,9 +14,9 @@ set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
${CMAKE_MODULE_PATH}
)
# Require out of source build.
@@ -26,10 +26,6 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LIBCXX_BUILT_STANDALONE 1)
endif()
#===============================================================================
# Setup CMake Options
#===============================================================================
@@ -42,15 +38,6 @@ option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
if (NOT DEFINED LIBCXX_CXX_ABI)
set(LIBCXX_CXX_ABI "none")
endif()
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
"Specify C++ ABI library to use." FORCE)
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
#===============================================================================
# Configure System
@@ -71,100 +58,6 @@ get_target_triple(LIBCXX_TARGET_TRIPLE
)
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
#===============================================================================
# Add an ABI library if appropriate
#===============================================================================
#
# _setup_abi: Set up the build to use an ABI library
#
# Parameters:
# abidefines: A list of defines needed to compile libc++ with the ABI library
# abilibs : A list of libraries to link against
# abifiles : A list of files (which may be relative paths) to copy into the
# libc++ build tree for the build. These files will also be
# installed alongside the libc++ headers.
# abidirs : A list of relative paths to create under an include directory
# in the libc++ build directory.
#
macro(setup_abi_lib abipathvar abidefines abilibs abifiles abidirs)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS ${abidefines})
set(${abipathvar} "${${abipathvar}}"
CACHE STRINGS
"Paths to ABI include directories separate by ';'."
)
set(LIBCXX_CXX_ABI_LIBRARIES ${abilibs})
set(LIBCXX_ABILIB_FILES ${abifiles})
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
foreach(_d ${abidirs})
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/${_d}")
endforeach()
set(LIBCXX_ABILIB_FILE_PATHS)
foreach(fpath ${LIBCXX_ABILIB_FILES})
set(found FALSE)
foreach(incpath ${${abipathvar}})
if (EXISTS "${incpath}/${fpath}")
set(found TRUE)
get_filename_component(dstdir ${fpath} PATH)
get_filename_component(ifile ${fpath} NAME)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/include/${dstdir}/${ifile}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${incpath}/${fpath}"
"${CMAKE_BINARY_DIR}/include/${dstdir}"
MAIN_DEPENDENCY "${incpath}/${fpath}"
)
list(APPEND LIBCXX_CXX_ABI_DEPS
"${CMAKE_BINARY_DIR}/include/${dstdir}/${ifile}"
)
endif()
endforeach()
if (NOT found)
message(FATAL_ERROR "Failed to find ${fpath}")
endif()
endforeach()
add_custom_target(abilib_headers DEPENDS ${LIBCXX_CXX_ABI_DEPS})
set(LIBCXX_CXX_ABI_DEPS abilib_headers)
include_directories("${CMAKE_BINARY_DIR}/include")
install(DIRECTORY "${CMAKE_BINARY_DIR}/include/"
DESTINATION include/c++/v1
FILES_MATCHING
PATTERN "*"
)
endmacro()
if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++" OR
"${LIBCXX_CXX_ABI}" STREQUAL "libsupc++")
set(_LIBSUPCXX_INCLUDE_FILES
cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h
bits/cxxabi_tweaks.h bits/cxxabi_forced.h
)
if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++")
set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX")
set(_LIBSUPCXX_LIBNAME stdc++)
else()
set(_LIBSUPCXX_DEFINES "")
set(_LIBSUPCXX_LIBNAME supc++)
endif()
setup_abi_lib("LIBCXX_LIBSUPCXX_INCLUDE_PATHS"
"-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}"
"${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
)
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
"c++abi" "cxxabi.h" ""
)
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt")
setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT"
"cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
)
elseif (NOT "${LIBCXX_CXX_ABI}" STREQUAL "none")
message(FATAL_ERROR
"Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
"supported for c++ abi."
)
endif ()
# Configure compiler.
include(config-ix)
@@ -194,24 +87,17 @@ macro(append_if list condition var)
endmacro()
# Get warning flags
if (NOT MSVC)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
set(LIBCXX_CXX_REQUIRED_FLAGS, -Werror=return-type)
endif()
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
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_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
else()
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_ERROR_FLAG -Wno-error)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_NO_WX_FLAG -WX-)
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_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
endif()
# Get feature flags.
@@ -233,8 +119,7 @@ if (NOT LIBCXX_ENABLE_RTTI)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
endif()
# Assert
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
if (LIBCXX_ENABLE_ASSERTIONS)
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)
@@ -249,16 +134,8 @@ else()
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
endif()
endif()
# Static library
if (NOT LIBCXX_ENABLE_SHARED)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_BUILD_STATIC)
endif()
# This is the _ONLY_ place where add_definitions is called.
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
add_definitions(
${LIBCXX_CXX_REQUIRED_FLAGS}
${LIBCXX_CXX_WARNING_FLAGS}
@@ -270,7 +147,6 @@ add_definitions(
#===============================================================================
include_directories(include)
add_subdirectory(include)
# Add source code. This also contains all of the logic for deciding linker flags
# soname, etc...

View File

@@ -8,116 +8,15 @@ 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: Saleem Abdulrasool
E: compnerd@compnerd.org
D: Minor patches and Linux fixes.
N: Dimitry Andric
E: dimitry@andric.com
D: Visibility fixes, minor FreeBSD portability patches.
N: Holger Arnold
E: holgerar@gmail.com
D: Minor fix.
N: Ruben Van Boxem
E: vanboxem dot ruben at gmail dot com
D: Initial Windows patches.
N: David Chisnall
E: theraven at theravensnest dot org
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
N: Marshall Clow
E: mclow.lists@gmail.com
E: marshall@idio.com
D: C++14 support, patches and bug fixes.
N: Bill Fisher
E: william.w.fisher@gmail.com
D: Regex bug fixes.
N: Matthew Dempsky
E: matthew@dempsky.org
D: Minor patches and bug fixes.
N: Google Inc.
D: Copyright owner and contributor of the CityHash algorithm
N: Howard Hinnant
E: hhinnant@apple.com
D: Architect and primary author of libc++
N: Hyeon-bin Jeong
E: tuhertz@gmail.com
N: Marshall Clow
E: marshall@idio.com
E: mclow@qualcomm.com
D: Minor patches and bug fixes.
N: Argyrios Kyrtzidis
E: kyrtzidis@apple.com
D: Bug fixes.
N: Bruce Mitchener, Jr.
E: bruce.mitchener@gmail.com
D: Emscripten-related changes.
N: Michel Morin
E: mimomorin@gmail.com
D: Minor patches to is_convertible.
N: Andrew Morrow
E: andrew.c.morrow@gmail.com
D: Minor patches and Linux fixes.
N: Arvid Picciani
E: aep at exys dot org
D: Minor patches and musl port.
N: Bjorn Reese
E: breese@users.sourceforge.net
D: Initial regex prototype
N: Nico Rieck
E: nico.rieck@gmail.com
D: Windows fixes
N: Jonathan Sauer
D: Minor patches, mostly related to constexpr
N: Craig Silverstein
E: csilvers@google.com
D: Implemented Cityhash as the string hash function on 64-bit machines
N: Richard Smith
D: Minor patches.
N: Joerg Sonnenberger
E: joerg@NetBSD.org
D: NetBSD port.
N: Stephan Tolksdorf
E: st@quanttec.com
D: Minor <atomic> fix
N: Michael van der Westhuizen
E: r1mikey at gmail dot com
N: Klaas de Vries
E: klaas at klaasgaaf dot nl
D: Minor bug fix.
N: Zhang Xiongpang
E: zhangxiongpang@gmail.com
D: Minor patches and bug fixes.
N: Xing Xue
E: xingxue@ca.ibm.com
D: AIX port
N: Zhihao Yuan
E: lichray@gmail.com
D: Standard compatibility fixes.
N: Jeffrey Yasskin
E: jyasskin@gmail.com
E: jyasskin@google.com
D: Linux fixes.

View File

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

View File

@@ -1,5 +1,5 @@
##
# libc++ Makefile
# libcpp Makefile
##
SRCDIRS = .
@@ -14,12 +14,9 @@ ifeq (,$(RC_INDIGO))
else
INSTALL_PREFIX="$(SDKROOT)"
endif
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
.PHONY: help installsrc clean installheaders install
help::
@echo "Use make install DSTROOT=<destination>"
echo Use make install DSTROOT=<destination>
installsrc:: $(SRCROOT)
@@ -30,25 +27,21 @@ installsrc:: $(SRCROOT)
clean::
# The installheaders target is used by clang's runtime/libcxx makefile.
installheaders::
mkdir -p $(HEADER_DIR)/c++/v1/ext
(cd $(SRCDIRS)/include && tar cf - --exclude=support .) | \
(cd $(HEADER_DIR)/c++/v1 && tar xf -)
chmod 755 $(HEADER_DIR)/c++/v1
chmod 644 $(HEADER_DIR)/c++/v1/*
chmod 755 $(HEADER_DIR)/c++/v1/ext
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
chmod 755 $(HEADER_DIR)/c++/v1/experimental
chmod 644 $(HEADER_DIR)/c++/v1/experimental/*
installhdrs::
install::
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/*
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 $(INSTALL_DIR)/usr/lib
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \
$(SYMROOT)/usr/lib/libc++.1.dylib
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.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

View File

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

View File

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

View File

@@ -14,16 +14,12 @@
#include <__config>
#include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
template <class _Cp> class __bit_const_reference;
template <class _C, bool _IsConst> class __bit_iterator;
template <class _C> class __bit_const_reference;
template <class _Tp>
struct __has_storage_type
@@ -31,22 +27,22 @@ struct __has_storage_type
static const bool value = false;
};
template <class _Cp, bool = __has_storage_type<_Cp>::value>
template <class _C, bool = __has_storage_type<_C>::value>
class __bit_reference
{
typedef typename _Cp::__storage_type __storage_type;
typedef typename _Cp::__storage_pointer __storage_pointer;
typedef typename _C::__storage_type __storage_type;
typedef typename _C::__storage_pointer __storage_pointer;
__storage_pointer __seg_;
__storage_type __mask_;
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
friend typename _Cp::__self;
#if defined(__clang__)
friend typename _C::__self;
#else
friend class _Cp::__self;
friend class _C::__self;
#endif
friend class __bit_const_reference<_Cp>;
friend class __bit_iterator<_Cp, false>;
friend class __bit_const_reference<_C>;
friend class __bit_iterator<_C, false>;
public:
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __mask_);}
@@ -68,87 +64,76 @@ public:
{return operator=(static_cast<bool>(__x));}
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT
{return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const _NOEXCEPT
{return __bit_iterator<_C, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s), __mask_(__m) {}
};
template <class _Cp>
class __bit_reference<_Cp, false>
template <class _C>
class __bit_reference<_C, false>
{
};
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
template <class _C, class _D>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT
swap(__bit_reference<_C> __x, __bit_reference<_D> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
template <class _Cp, class _Dp>
inline _LIBCPP_INLINE_VISIBILITY
template <class _C>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT
swap(__bit_reference<_C> __x, bool& __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
template <class _C>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT
swap(bool& __x, __bit_reference<_C> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
void
swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
template <class _Cp>
template <class _C>
class __bit_const_reference
{
typedef typename _Cp::__storage_type __storage_type;
typedef typename _Cp::__const_storage_pointer __storage_pointer;
typedef typename _C::__storage_type __storage_type;
typedef typename _C::__const_storage_pointer __storage_pointer;
__storage_pointer __seg_;
__storage_type __mask_;
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
friend typename _Cp::__self;
#if defined(__clang__)
friend typename _C::__self;
#else
friend class _Cp::__self;
friend class _C::__self;
#endif
friend class __bit_iterator<_Cp, true>;
friend class __bit_iterator<_C, true>;
public:
_LIBCPP_INLINE_VISIBILITY
__bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
__bit_const_reference(const __bit_reference<_C>& __x) _NOEXCEPT
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT
{return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const _NOEXCEPT
{return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s), __mask_(__m) {}
@@ -157,11 +142,11 @@ private:
// find
template <class _Cp, bool _IsConst>
__bit_iterator<_Cp, _IsConst>
__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
template <class _C>
__bit_iterator<_C, false>
__find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{
typedef __bit_iterator<_Cp, _IsConst> _It;
typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
@@ -173,8 +158,6 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
__storage_type __b = *__first.__seg_ & __m;
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
if (__n == __dn)
return _It(__first.__seg_, __first.__ctz_ + __n);
__n -= __dn;
++__first.__seg_;
}
@@ -193,11 +176,11 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
return _It(__first.__seg_, static_cast<unsigned>(__n));
}
template <class _Cp, bool _IsConst>
__bit_iterator<_Cp, _IsConst>
__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
template <class _C>
__bit_iterator<_C, false>
__find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{
typedef __bit_iterator<_Cp, _IsConst> _It;
typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
@@ -206,11 +189,9 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b = ~*__first.__seg_ & __m;
__storage_type __b = ~(*__first.__seg_ & __m);
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
if (__n == __dn)
return _It(__first.__seg_, __first.__ctz_ + __n);
__n -= __dn;
++__first.__seg_;
}
@@ -225,30 +206,30 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b = ~*__first.__seg_ & __m;
__storage_type __b = ~(*__first.__seg_ & __m);
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
}
return _It(__first.__seg_, static_cast<unsigned>(__n));
}
template <class _Cp, bool _IsConst, class _Tp>
template <class _C, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_Cp, _IsConst>
find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
__bit_iterator<_C, false>
find(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
{
if (static_cast<bool>(__value_))
return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
if (static_cast<bool>(__value))
return __find_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
return __find_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
}
// count
template <class _Cp, bool _IsConst>
typename __bit_iterator<_Cp, _IsConst>::difference_type
__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
template <class _C>
typename __bit_iterator<_C, false>::difference_type
__count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{
typedef __bit_iterator<_Cp, _IsConst> _It;
typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type;
typedef typename _It::difference_type difference_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -275,11 +256,11 @@ __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
return __r;
}
template <class _Cp, bool _IsConst>
typename __bit_iterator<_Cp, _IsConst>::difference_type
__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
template <class _C>
typename __bit_iterator<_C, false>::difference_type
__count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{
typedef __bit_iterator<_Cp, _IsConst> _It;
typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type;
typedef typename _It::difference_type difference_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -290,7 +271,7 @@ __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_typ
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__r = _VSTD::__pop_count(~*__first.__seg_ & __m);
__r = _VSTD::__pop_count(~(*__first.__seg_ & __m));
__n -= __dn;
++__first.__seg_;
}
@@ -301,28 +282,28 @@ __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_typ
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
__r += _VSTD::__pop_count(~*__first.__seg_ & __m);
__r += _VSTD::__pop_count(~(*__first.__seg_ & __m));
}
return __r;
}
template <class _Cp, bool _IsConst, class _Tp>
template <class _C, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename __bit_iterator<_Cp, _IsConst>::difference_type
count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
typename __bit_iterator<_C, false>::difference_type
count(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
{
if (static_cast<bool>(__value_))
return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
if (static_cast<bool>(__value))
return __count_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
return __count_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
}
// fill_n
template <class _Cp>
template <class _C>
void
__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
__fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{
typedef __bit_iterator<_Cp, false> _It;
typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
@@ -337,7 +318,7 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
}
// do middle whole words
__storage_type __nw = __n / __bits_per_word;
_VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type));
_VSTD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last partial word
if (__n > 0)
@@ -348,11 +329,11 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
}
}
template <class _Cp>
template <class _C>
void
__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
__fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{
typedef __bit_iterator<_Cp, false> _It;
typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
@@ -367,7 +348,7 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
}
// do middle whole words
__storage_type __nw = __n / __bits_per_word;
_VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type));
_VSTD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last partial word
if (__n > 0)
@@ -378,14 +359,14 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
}
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
template <class _C>
_LIBCPP_INLINE_VISIBILITY inline
void
fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_)
fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __value)
{
if (__n > 0)
{
if (__value_)
if (__value)
__fill_n_true(__first, __n);
else
__fill_n_false(__first, __n);
@@ -394,22 +375,22 @@ fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __v
// fill
template <class _Cp>
template <class _C>
inline _LIBCPP_INLINE_VISIBILITY
void
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_)
fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value)
{
_VSTD::fill_n(__first, static_cast<typename _Cp::size_type>(__last - __first), __value_);
_VSTD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
}
// copy
template <class _Cp, bool _IsConst>
__bit_iterator<_Cp, false>
__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
__bit_iterator<_Cp, false> __result)
template <class _C, bool _IsConst>
__bit_iterator<_C, false>
__copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
__bit_iterator<_C, false> __result)
{
typedef __bit_iterator<_Cp, _IsConst> _In;
typedef __bit_iterator<_C, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -434,9 +415,7 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon
// __first.__ctz_ == 0;
// do middle words
__storage_type __nw = __n / __bits_per_word;
_VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
_VSTD::__to_raw_pointer(__first.__seg_),
__nw * sizeof(__storage_type));
_VSTD::memmove(__result.__seg_, __first.__seg_, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
__result.__seg_ += __nw;
// do last word
@@ -453,12 +432,12 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon
return __result;
}
template <class _Cp, bool _IsConst>
__bit_iterator<_Cp, false>
__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
__bit_iterator<_Cp, false> __result)
template <class _C, bool _IsConst>
__bit_iterator<_C, false>
__copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
__bit_iterator<_C, false> __result)
{
typedef __bit_iterator<_Cp, _IsConst> _In;
typedef __bit_iterator<_C, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -531,10 +510,10 @@ __copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsC
return __result;
}
template <class _Cp, bool _IsConst>
template <class _C, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_Cp, false>
copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
__bit_iterator<_C, false>
copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
{
if (__first.__ctz_ == __result.__ctz_)
return __copy_aligned(__first, __last, __result);
@@ -543,12 +522,12 @@ copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last
// copy_backward
template <class _Cp, bool _IsConst>
__bit_iterator<_Cp, false>
__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
__bit_iterator<_Cp, false> __result)
template <class _C, bool _IsConst>
__bit_iterator<_C, false>
__copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
__bit_iterator<_C, false> __result)
{
typedef __bit_iterator<_Cp, _IsConst> _In;
typedef __bit_iterator<_C, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -575,9 +554,7 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C
__storage_type __nw = __n / __bits_per_word;
__result.__seg_ -= __nw;
__last.__seg_ -= __nw;
_VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
_VSTD::__to_raw_pointer(__last.__seg_),
__nw * sizeof(__storage_type));
_VSTD::memmove(__result.__seg_, __last.__seg_, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last word
if (__n > 0)
@@ -592,12 +569,12 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C
return __result;
}
template <class _Cp, bool _IsConst>
__bit_iterator<_Cp, false>
__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
__bit_iterator<_Cp, false> __result)
template <class _C, bool _IsConst>
__bit_iterator<_C, false>
__copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
__bit_iterator<_C, false> __result)
{
typedef __bit_iterator<_Cp, _IsConst> _In;
typedef __bit_iterator<_C, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -656,7 +633,7 @@ __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<
{
__m = ~__storage_type(0) << (__bits_per_word - __n);
__storage_type __b = *--__last.__seg_ & __m;
__clz_r = __bits_per_word - __result.__ctz_;
unsigned __clz_r = __bits_per_word - __result.__ctz_;
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
*__result.__seg_ &= ~__m;
@@ -678,10 +655,10 @@ __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<
return __result;
}
template <class _Cp, bool _IsConst>
template <class _C, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_Cp, false>
copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
__bit_iterator<_C, false>
copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
{
if (__last.__ctz_ == __result.__ctz_)
return __copy_backward_aligned(__first, __last, __result);
@@ -690,32 +667,32 @@ copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCons
// move
template <class _Cp, bool _IsConst>
template <class _C, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_Cp, false>
move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
__bit_iterator<_C, false>
move(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
{
return _VSTD::copy(__first, __last, __result);
}
// move_backward
template <class _Cp, bool _IsConst>
template <class _C, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_Cp, false>
move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
__bit_iterator<_C, false>
move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
{
return _VSTD::copy(__first, __last, __result);
}
// swap_ranges
template <class __C1, class __C2>
__bit_iterator<__C2, false>
__swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
__bit_iterator<__C2, false> __result)
template <class _C1, class _C2>
__bit_iterator<_C2, false>
__swap_ranges_aligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
__bit_iterator<_C2, false> __result)
{
typedef __bit_iterator<__C1, false> _I1;
typedef __bit_iterator<_C1, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
@@ -760,12 +737,12 @@ __swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1,
return __result;
}
template <class __C1, class __C2>
__bit_iterator<__C2, false>
__swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
__bit_iterator<__C2, false> __result)
template <class _C1, class _C2>
__bit_iterator<_C2, false>
__swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
__bit_iterator<_C2, false> __result)
{
typedef __bit_iterator<__C1, false> _I1;
typedef __bit_iterator<_C1, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
@@ -860,11 +837,11 @@ __swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1
return __result;
}
template <class __C1, class __C2>
template <class _C1, class _C2>
inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<__C2, false>
swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1,
__bit_iterator<__C2, false> __first2)
__bit_iterator<_C2, false>
swap_ranges(__bit_iterator<_C1, false> __first1, __bit_iterator<_C1, false> __last1,
__bit_iterator<_C2, false> __first2)
{
if (__first1.__ctz_ == __first2.__ctz_)
return __swap_ranges_aligned(__first1, __last1, __first2);
@@ -873,40 +850,34 @@ swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __
// rotate
template <class _Cp>
template <class _C>
struct __bit_array
{
typedef typename _Cp::difference_type difference_type;
typedef typename _Cp::__storage_type __storage_type;
typedef typename _Cp::__storage_pointer __storage_pointer;
typedef typename _Cp::iterator iterator;
static const unsigned __bits_per_word = _Cp::__bits_per_word;
static const unsigned _Np = 4;
typedef typename _C::difference_type difference_type;
typedef typename _C::__storage_type __storage_type;
typedef typename _C::iterator iterator;
static const unsigned __bits_per_word = _C::__bits_per_word;
static const unsigned _N = 4;
difference_type __size_;
__storage_type __word_[_Np];
__storage_type __word_[_N];
_LIBCPP_INLINE_VISIBILITY static difference_type capacity()
{return static_cast<difference_type>(_Np * __bits_per_word);}
{return static_cast<difference_type>(_N * __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
_LIBCPP_INLINE_VISIBILITY iterator begin()
{
return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0);
}
_LIBCPP_INLINE_VISIBILITY iterator end()
{
return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word,
static_cast<unsigned>(__size_ % __bits_per_word));
}
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);}
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word,
static_cast<unsigned>(__size_ % __bits_per_word));}
};
template <class _Cp>
__bit_iterator<_Cp, false>
rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last)
template <class _C>
__bit_iterator<_C, false>
rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __bit_iterator<_C, false> __last)
{
typedef __bit_iterator<_Cp, false> _I1;
typedef __bit_iterator<_C, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
difference_type __d1 = __middle - __first;
difference_type __d2 = __last - __middle;
_I1 __r = __first + __d2;
@@ -914,16 +885,16 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
{
if (__d1 <= __d2)
{
if (__d1 <= __bit_array<_Cp>::capacity())
if (__d1 <= __bit_array<_C>::capacity())
{
__bit_array<_Cp> __b(__d1);
__bit_array<_C> __b(__d1);
_VSTD::copy(__first, __middle, __b.begin());
_VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
break;
}
else
{
__bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
__bit_iterator<_C, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
__first = __middle;
__middle = __mp;
__d2 -= __d1;
@@ -931,16 +902,16 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
}
else
{
if (__d2 <= __bit_array<_Cp>::capacity())
if (__d2 <= __bit_array<_C>::capacity())
{
__bit_array<_Cp> __b(__d2);
__bit_array<_C> __b(__d2);
_VSTD::copy(__middle, __last, __b.begin());
_VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
break;
}
else
{
__bit_iterator<_Cp, false> __mp = __first + __d2;
__bit_iterator<_C, false> __mp = __first + __d2;
_VSTD::swap_ranges(__first, __mp, __middle);
__first = __mp;
__d1 -= __d2;
@@ -952,12 +923,12 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
// equal
template <class _Cp, bool _IC1, bool _IC2>
template <class _C>
bool
__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
__bit_iterator<_Cp, _IC2> __first2)
__equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
__bit_iterator<_C, true> __first2)
{
typedef __bit_iterator<_Cp, _IC1> _It;
typedef __bit_iterator<_C, true> _It;
typedef typename _It::difference_type difference_type;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -976,15 +947,11 @@ __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1>
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
if (__first2.__ctz_ > __first1.__ctz_)
{
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
return false;
}
else
{
if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
return false;
}
__first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
__first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word);
__dn -= __ddn;
@@ -1034,12 +1001,12 @@ __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1>
return true;
}
template <class _Cp, bool _IC1, bool _IC2>
template <class _C>
bool
__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
__bit_iterator<_Cp, _IC2> __first2)
__equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
__bit_iterator<_C, true> __first2)
{
typedef __bit_iterator<_Cp, _IC1> _It;
typedef __bit_iterator<_C, true> _It;
typedef typename _It::difference_type difference_type;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -1077,45 +1044,40 @@ __equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __
return true;
}
template <class _Cp, bool _IC1, bool _IC2>
template <class _C, bool _IC1, bool _IC2>
inline _LIBCPP_INLINE_VISIBILITY
bool
equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2)
equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2)
{
if (__first1.__ctz_ == __first2.__ctz_)
return __equal_aligned(__first1, __last1, __first2);
return __equal_unaligned(__first1, __last1, __first2);
}
template <class _Cp, bool _IsConst,
typename _Cp::__storage_type>
template <class _C, bool _IsConst>
class __bit_iterator
{
public:
typedef typename _Cp::difference_type difference_type;
typedef typename _C::difference_type difference_type;
typedef bool value_type;
typedef __bit_iterator pointer;
typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference;
typedef typename conditional<_IsConst, __bit_const_reference<_C>, __bit_reference<_C> >::type reference;
typedef random_access_iterator_tag iterator_category;
private:
typedef typename _Cp::__storage_type __storage_type;
typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer,
typename _Cp::__storage_pointer>::type __storage_pointer;
static const unsigned __bits_per_word = _Cp::__bits_per_word;
typedef typename _C::__storage_type __storage_type;
typedef typename conditional<_IsConst, typename _C::__const_storage_pointer,
typename _C::__storage_pointer>::type __storage_pointer;
static const unsigned __bits_per_word = _C::__bits_per_word;
__storage_pointer __seg_;
unsigned __ctz_;
public:
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
: __seg_(nullptr), __ctz_(0)
#endif
{}
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY
__bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
__bit_iterator(const __bit_iterator<_C, false>& __it) _NOEXCEPT
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
@@ -1222,64 +1184,60 @@ private:
__bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
: __seg_(__s), __ctz_(__ctz) {}
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
friend typename _Cp::__self;
#if defined(__clang__)
friend typename _C::__self;
#else
friend class _Cp::__self;
friend class _C::__self;
#endif
friend class __bit_reference<_Cp>;
friend class __bit_const_reference<_Cp>;
friend class __bit_iterator<_Cp, true>;
template <class _Dp> friend struct __bit_array;
template <class _Dp> friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
template <class _Dp> friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first,
__bit_iterator<_Dp, _IC> __last,
__bit_iterator<_Dp, false> __result);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first,
__bit_iterator<_Dp, _IC> __last,
__bit_iterator<_Dp, false> __result);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first,
__bit_iterator<_Dp, _IC> __last,
__bit_iterator<_Dp, false> __result);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first,
__bit_iterator<_Dp, _IC> __last,
__bit_iterator<_Dp, false> __result);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first,
__bit_iterator<_Dp, _IC> __last,
__bit_iterator<_Dp, false> __result);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first,
__bit_iterator<_Dp, _IC> __last,
__bit_iterator<_Dp, false> __result);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
template <class _Dp> friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>,
__bit_iterator<_Dp, false>,
__bit_iterator<_Dp, false>);
template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>,
__bit_iterator<_Dp, _IC1>,
__bit_iterator<_Dp, _IC2>);
template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>,
__bit_iterator<_Dp, _IC1>,
__bit_iterator<_Dp, _IC2>);
template <class _Dp, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_Dp, _IC1>,
__bit_iterator<_Dp, _IC1>,
__bit_iterator<_Dp, _IC2>);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>,
typename _Dp::size_type);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>,
typename _Dp::size_type);
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
__count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
__count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
friend class __bit_reference<_C>;
friend class __bit_const_reference<_C>;
friend class __bit_iterator<_C, true>;
template <class _D> friend struct __bit_array;
template <class _D> friend void __fill_n_false(__bit_iterator<_D, false> __first, typename _D::size_type __n);
template <class _D> friend void __fill_n_true(__bit_iterator<_D, false> __first, typename _D::size_type __n);
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_aligned(__bit_iterator<_D, _IC> __first,
__bit_iterator<_D, _IC> __last,
__bit_iterator<_D, false> __result);
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_unaligned(__bit_iterator<_D, _IC> __first,
__bit_iterator<_D, _IC> __last,
__bit_iterator<_D, false> __result);
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy(__bit_iterator<_D, _IC> __first,
__bit_iterator<_D, _IC> __last,
__bit_iterator<_D, false> __result);
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_aligned(__bit_iterator<_D, _IC> __first,
__bit_iterator<_D, _IC> __last,
__bit_iterator<_D, false> __result);
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_unaligned(__bit_iterator<_D, _IC> __first,
__bit_iterator<_D, _IC> __last,
__bit_iterator<_D, false> __result);
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first,
__bit_iterator<_D, _IC> __last,
__bit_iterator<_D, false> __result);
template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_aligned(__bit_iterator<_C1, false>,
__bit_iterator<_C1, false>,
__bit_iterator<_C2, false>);
template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_unaligned(__bit_iterator<_C1, false>,
__bit_iterator<_C1, false>,
__bit_iterator<_C2, false>);
template <class _C1, class _C2>friend __bit_iterator<_C2, false> swap_ranges(__bit_iterator<_C1, false>,
__bit_iterator<_C1, false>,
__bit_iterator<_C2, false>);
template <class _D> friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>,
__bit_iterator<_D, false>,
__bit_iterator<_D, false>);
template <class _D> friend bool __equal_aligned(__bit_iterator<_D, true>,
__bit_iterator<_D, true>,
__bit_iterator<_D, true>);
template <class _D> friend bool __equal_unaligned(__bit_iterator<_D, true>,
__bit_iterator<_D, true>,
__bit_iterator<_D, true>);
template <class _D, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_D, _IC1>,
__bit_iterator<_D, _IC1>,
__bit_iterator<_D, _IC2>);
template <class _D> friend __bit_iterator<_D, false> __find_bool_true(__bit_iterator<_D, false>,
typename _D::size_type);
template <class _D> friend __bit_iterator<_D, false> __find_bool_false(__bit_iterator<_D, false>,
typename _D::size_type);
};
_LIBCPP_END_NAMESPACE_STD

View File

@@ -11,15 +11,9 @@
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG
#if !defined(_MSC_VER) || defined(__clang__)
#pragma GCC system_header
#endif
#ifdef __GNUC__
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#endif
#define _LIBCPP_VERSION 1101
#define _LIBCPP_VERSION 1000
#define _LIBCPP_ABI_VERSION 1
@@ -51,61 +45,13 @@
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
# ifndef __LONG_LONG_SUPPORTED
# define _LIBCPP_HAS_NO_LONG_LONG
# endif // __LONG_LONG_SUPPORTED
#endif // __FreeBSD__
#ifdef __NetBSD__
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# else // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_HAS_QUICK_EXIT
#endif // __NetBSD__
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
// Compiler intrinsics (GCC or MSVC)
# if defined(__clang__) \
|| (defined(_MSC_VER) && _MSC_VER >= 1400) \
|| (defined(__GNUC__) && _GNUC_VER > 403)
# define _LIBCPP_HAS_IS_BASE_OF
# endif
# if defined(_MSC_VER) && !defined(__clang__)
# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
# define _LIBCPP_TOSTRING2(x) #x
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
# endif
# // If mingw not explicitly detected, assume using MS C runtime only.
# ifndef __MINGW32__
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
# endif
#endif // _WIN32
#ifdef __linux__
# if defined(__GNUC__) && _GNUC_VER >= 403
# define _LIBCPP_HAS_IS_BASE_OF
# endif
#endif
#ifdef __sun__
# include <sys/isa_defs.h>
# ifdef _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# else
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif
#endif // __sun__
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -119,98 +65,32 @@
# endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
#ifdef _WIN32
// only really useful for a DLL
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
# ifdef cxx_EXPORTS
# define _LIBCPP_HIDDEN
# define _LIBCPP_FUNC_VIS __declspec(dllexport)
# define _LIBCPP_TYPE_VIS __declspec(dllexport)
# else
# define _LIBCPP_HIDDEN
# define _LIBCPP_FUNC_VIS __declspec(dllimport)
# define _LIBCPP_TYPE_VIS __declspec(dllimport)
# endif
#else
# define _LIBCPP_HIDDEN
# define _LIBCPP_FUNC_VIS
# define _LIBCPP_TYPE_VIS
#ifndef _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_VISIBILITY_TAG 1
#endif
#define _LIBCPP_TYPE_VIS_ONLY
#define _LIBCPP_FUNC_VIS_ONLY
#ifndef _LIBCPP_INLINE_VISIBILITY
# ifdef _LIBCPP_MSVC
# define _LIBCPP_INLINE_VISIBILITY __forceinline
# else // MinGW GCC and Clang
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
# endif
#endif
#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
# ifdef _LIBCPP_MSVC
# define _LIBCPP_ALWAYS_INLINE __forceinline
# endif
#endif
#endif // _WIN32
#ifndef __has_attribute
#define __has_attribute(__x) 0
#endif
#ifndef _LIBCPP_HIDDEN
#if _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
#endif
#ifndef _LIBCPP_FUNC_VIS
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
#endif
#ifndef _LIBCPP_TYPE_VIS
# if __has_attribute(__type_visibility__)
# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
# else
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
# endif
#endif
#ifndef _LIBCPP_TYPE_VIS_ONLY
# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
#endif
#ifndef _LIBCPP_FUNC_VIS_ONLY
# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
#endif
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
#else // _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_HIDDEN
#define _LIBCPP_VISIBLE
#endif // _LIBCPP_VISIBILITY_TAG
#ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
#if defined(__clang__)
#if __has_feature(cxx_alignas)
# define _ALIGNAS_TYPE(x) alignas(x)
# define _ALIGNAS(x) alignas(x)
#else
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
#endif
#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif
@@ -232,23 +112,17 @@ typedef __char32_t char32_t;
#define _LIBCPP_NO_RTTI
#endif
#if !(__has_feature(cxx_strong_enums))
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE
#endif
#if __has_feature(cxx_attributes)
# define _LIBCPP_NORETURN [[noreturn]]
# define _ATTRIBUTE(x) [[x]]
#else
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
# define _ATTRIBUTE(x) __attribute__ ((x))
#endif
#if !(__has_feature(cxx_defaulted_functions))
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#endif // !(__has_feature(cxx_defaulted_functions))
#if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
@@ -272,9 +146,6 @@ typedef __char32_t char32_t;
#if !(__has_feature(cxx_auto_type))
#define _LIBCPP_HAS_NO_AUTO_TYPE
#endif
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
@@ -286,14 +157,6 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#endif
#if !(__has_feature(cxx_generalized_initializers))
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif
#if __has_feature(is_base_of)
# define _LIBCPP_HAS_IS_BASE_OF
#endif
// Objective-C++ features (opt-in)
#if __has_feature(objc_arc)
#define _LIBCPP_HAS_OBJC_ARC
@@ -301,38 +164,6 @@ typedef __char32_t char32_t;
#if __has_feature(objc_arc_weak)
#define _LIBCPP_HAS_OBJC_ARC_WEAK
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
#if defined(__FreeBSD__)
#define _LIBCPP_HAS_QUICK_EXIT
#define _LIBCPP_HAS_C11_FEATURES
#elif defined(__linux__)
#include <features.h>
#if __GLIBC_PREREQ(2, 15)
#define _LIBCPP_HAS_QUICK_EXIT
#endif
#if __GLIBC_PREREQ(2, 17)
#define _LIBCPP_HAS_C11_FEATURES
#endif
#endif
#endif
#if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
#if __has_feature(underlying_type)
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
#endif
// Inline namespaces are available in Clang regardless of C++ dialect.
@@ -345,12 +176,23 @@ namespace std {
}
}
#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__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
#define _LIBCPP_NORETURN __attribute__((noreturn))
#define _ATTRIBUTE(x) __attribute__((x))
#if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS
@@ -380,25 +222,24 @@ namespace std {
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if _GNUC_VER < 403
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#if _GNUC_VER < 403
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
#if _GNUC_VER < 404
#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
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _GNUC_VER < 404
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#if _GNUC_VER < 406
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
#define _LIBCPP_HAS_NO_NULLPTR
#endif
@@ -414,63 +255,7 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}
#elif defined(_LIBCPP_MSVC)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn)
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
#define _VSTD std
# define _LIBCPP_WEAK
namespace std {
}
#elif defined(__IBMCPP__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
#define _ATTRIBUTE(x) __attribute__((x))
#define _LIBCPP_NORETURN __attribute__((noreturn))
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_HAS_IS_BASE_OF
#if defined(_AIX)
#define __MULTILOCALE_API
#endif
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE
namespace std {
inline namespace _LIBCPP_NAMESPACE {
}
}
#endif // __clang__ || __GNUC___ || _MSC_VER || __IBMCPP__
#endif // defined(__GNUC__)
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
@@ -493,128 +278,19 @@ template <unsigned> struct __static_assert_check {};
#endif
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_CONSTEXPR
#else
#define _LIBCPP_CONSTEXPR constexpr
#endif
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_DEFAULT {}
#else
#define _LIBCPP_DEFAULT = default;
#endif
#ifdef __GNUC__
#define _NOALIAS __attribute__((__malloc__))
#else
#define _NOALIAS
#define constexpr const
#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
#if __has_feature(cxx_explicit_conversions)
# define _LIBCPP_EXPLICIT explicit
#else
# define _LIBCPP_EXPLICIT
#ifdef __APPLE__
#define _LIBCPP_STABLE_APPLE_ABI
#endif
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
__lx __v_; \
_LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
};
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
#ifdef _LIBCPP_DEBUG
# if _LIBCPP_DEBUG == 0
# define _LIBCPP_DEBUG_LEVEL 1
# elif _LIBCPP_DEBUG == 1
# define _LIBCPP_DEBUG_LEVEL 2
# else
# error Supported values for _LIBCPP_DEBUG are 0 and 1
# endif
# define _LIBCPP_EXTERN_TEMPLATE(...)
#endif
#ifndef _LIBCPP_EXTERN_TEMPLATE
#define _LIBCPP_EXTERN_TEMPLATE(...)
#endif
#ifndef _LIBCPP_EXTERN_TEMPLATE2
#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
#ifdef __FreeBSD__
#define _DECLARE_C99_LDBL_MATH 1
#endif
#if defined(__APPLE__) || defined(__FreeBSD__)
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
#ifdef __APPLE__
#define _LIBCPP_WCTYPE_IS_MASK
#endif
#if defined(__APPLE__)
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 0
#endif
#endif
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
#endif
#ifndef _LIBCPP_STD_VER
# if __cplusplus <= 201103L
# define _LIBCPP_STD_VER 11
# else
# define _LIBCPP_STD_VER 13 // current year, or date of c++14 ratification
# endif
#endif // _LIBCPP_STD_VER
#if _LIBCPP_STD_VER > 11
#define _LIBCPP_DEPRECATED [[deprecated]]
#else
#define _LIBCPP_DEPRECATED
#endif
#if _LIBCPP_STD_VER <= 11
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
#define _LIBCPP_EXPLICIT_AFTER_CXX11
#define _LIBCPP_DEPRECATED_AFTER_CXX11
#else
#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
#endif
// Try to find out if RTTI is disabled.
// g++ and cl.exe have RTTI on by default and define a macro when it is.
// g++ only defines the macro in 4.3.2 and onwards.
#if !defined(_LIBCPP_NO_RTTI)
# if defined(__GNUG__) && (__GNUC__ >= 4 && \
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2)) && !defined(__GXX_RTTI)
# define _LIBCPP_NO_RTTI
# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
# define _LIBCPP_NO_RTTI
# endif
#endif
#ifndef _LIBCPP_WEAK
# define _LIBCPP_WEAK __attribute__((__weak__))
#endif
#endif // _LIBCPP_CONFIG

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -15,116 +15,39 @@
#include <type_traits>
#include <typeinfo>
#include <exception>
#include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
struct _LIBCPP_TYPE_VIS_ONLY unary_function
struct _LIBCPP_VISIBLE unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
template <class _Arg1, class _Arg2, class _Result>
struct _LIBCPP_TYPE_VIS_ONLY binary_function
struct _LIBCPP_VISIBLE binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
template <class _Tp> struct _LIBCPP_VISIBLE hash;
template <class _Tp>
struct __has_result_type
{
private:
struct __two {char __lx; char __lxx;};
struct __two {char _; char __;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::result_type* = 0);
public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TYPE_VIS_ONLY less : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x < __y;}
};
#if _LIBCPP_STD_VER > 11
template <>
struct _LIBCPP_TYPE_VIS_ONLY less<void>
{
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
auto operator()(_T1&& __t, _T2&& __u) const
{ return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
typedef void is_transparent;
};
#endif
// addressof
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp*
addressof(_Tp& __x) _NOEXCEPT
{
return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
}
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
// Objective-C++ Automatic Reference Counting uses qualified pointers
// that require special addressof() signatures. When
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
// itself is providing these definitions. Otherwise, we provide them.
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__strong _Tp*
addressof(__strong _Tp& __x) _NOEXCEPT
{
return &__x;
}
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__weak _Tp*
addressof(__weak _Tp& __x) _NOEXCEPT
{
return &__x;
}
#endif
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__autoreleasing _Tp*
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
{
return &__x;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__unsafe_unretained _Tp*
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
{
return &__x;
}
#endif
#ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03>
@@ -137,11 +60,11 @@ template <class _Tp>
struct __derives_from_unary_function
{
private:
struct __two {char __lx; char __lxx;};
struct __two {char _; char __;};
static __two __test(...);
template <class _Ap, class _Rp>
static unary_function<_Ap, _Rp>
__test(const volatile unary_function<_Ap, _Rp>*);
template <class _A, class _R>
static unary_function<_A, _R>
__test(const volatile unary_function<_A, _R>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
@@ -151,11 +74,11 @@ template <class _Tp>
struct __derives_from_binary_function
{
private:
struct __two {char __lx; char __lxx;};
struct __two {char _; char __;};
static __two __test(...);
template <class _A1, class _A2, class _Rp>
static binary_function<_A1, _A2, _Rp>
__test(const volatile binary_function<_A1, _A2, _Rp>*);
template <class _A1, class _A2, class _R>
static binary_function<_A1, _A2, _R>
__test(const volatile binary_function<_A1, _A2, _R>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
@@ -206,175 +129,173 @@ struct __weak_result_type
// 0 argument case
template <class _Rp>
struct __weak_result_type<_Rp ()>
template <class _R>
struct __weak_result_type<_R ()>
{
typedef _Rp result_type;
typedef _R result_type;
};
template <class _Rp>
struct __weak_result_type<_Rp (&)()>
template <class _R>
struct __weak_result_type<_R (&)()>
{
typedef _Rp result_type;
typedef _R result_type;
};
template <class _Rp>
struct __weak_result_type<_Rp (*)()>
template <class _R>
struct __weak_result_type<_R (*)()>
{
typedef _Rp result_type;
typedef _R result_type;
};
// 1 argument case
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (_A1)>
: public unary_function<_A1, _Rp>
template <class _R, class _A1>
struct __weak_result_type<_R (_A1)>
: public unary_function<_A1, _R>
{
};
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (&)(_A1)>
: public unary_function<_A1, _Rp>
template <class _R, class _A1>
struct __weak_result_type<_R (&)(_A1)>
: public unary_function<_A1, _R>
{
};
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (*)(_A1)>
: public unary_function<_A1, _Rp>
template <class _R, class _A1>
struct __weak_result_type<_R (*)(_A1)>
: public unary_function<_A1, _R>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)()>
: public unary_function<_Cp*, _Rp>
template <class _R, class _C>
struct __weak_result_type<_R (_C::*)()>
: public unary_function<_C*, _R>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() const>
: public unary_function<const _Cp*, _Rp>
template <class _R, class _C>
struct __weak_result_type<_R (_C::*)() const>
: public unary_function<const _C*, _R>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() volatile>
: public unary_function<volatile _Cp*, _Rp>
template <class _R, class _C>
struct __weak_result_type<_R (_C::*)() volatile>
: public unary_function<volatile _C*, _R>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
: public unary_function<const volatile _Cp*, _Rp>
template <class _R, class _C>
struct __weak_result_type<_R (_C::*)() const volatile>
: public unary_function<const volatile _C*, _R>
{
};
// 2 argument case
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
template <class _R, class _A1, class _A2>
struct __weak_result_type<_R (_A1, _A2)>
: public binary_function<_A1, _A2, _R>
{
};
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (*)(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
template <class _R, class _A1, class _A2>
struct __weak_result_type<_R (*)(_A1, _A2)>
: public binary_function<_A1, _A2, _R>
{
};
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (&)(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
template <class _R, class _A1, class _A2>
struct __weak_result_type<_R (&)(_A1, _A2)>
: public binary_function<_A1, _A2, _R>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
: public binary_function<_Cp*, _A1, _Rp>
template <class _R, class _C, class _A1>
struct __weak_result_type<_R (_C::*)(_A1)>
: public binary_function<_C*, _A1, _R>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
: public binary_function<const _Cp*, _A1, _Rp>
template <class _R, class _C, class _A1>
struct __weak_result_type<_R (_C::*)(_A1) const>
: public binary_function<const _C*, _A1, _R>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
: public binary_function<volatile _Cp*, _A1, _Rp>
template <class _R, class _C, class _A1>
struct __weak_result_type<_R (_C::*)(_A1) volatile>
: public binary_function<volatile _C*, _A1, _R>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
: public binary_function<const volatile _Cp*, _A1, _Rp>
template <class _R, class _C, class _A1>
struct __weak_result_type<_R (_C::*)(_A1) const volatile>
: public binary_function<const volatile _C*, _A1, _R>
{
};
// 3 or more arguments
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
{
typedef _Rp result_type;
typedef _R result_type;
};
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
{
typedef _Rp result_type;
typedef _R result_type;
};
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
{
typedef _Rp result_type;
typedef _R result_type;
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
{
typedef _Rp result_type;
typedef _R result_type;
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
{
typedef _Rp result_type;
typedef _R result_type;
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
{
typedef _Rp result_type;
typedef _R result_type;
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
{
typedef _Rp result_type;
typedef _R result_type;
};
// __invoke
// bullets 1 and 2
template <class _Fp, class _A0, class ..._Args,
class>
template <class _F, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
{
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Fp, class _A0, class ..._Args,
class>
template <class _F, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
{
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
@@ -382,21 +303,19 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
// bullets 3 and 4
template <class _Fp, class _A0,
class>
template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
__invoke(_F&& __f, _A0&& __a0)
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
{
return _VSTD::forward<_A0>(__a0).*__f;
}
template <class _Fp, class _A0,
class>
template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
__invoke(_F&& __f, _A0&& __a0)
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
{
return (*_VSTD::forward<_A0>(__a0)).*__f;
@@ -404,13 +323,13 @@ __invoke(_Fp&& __f, _A0&& __a0)
// bullet 5
template <class _Fp, class ..._Args>
template <class _F, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _Args&& ...__args)
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
__invoke(_F&& __f, _Args&& ...__args)
-> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...))
{
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
return _VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class ..._Args>
@@ -420,7 +339,7 @@ struct __invoke_return
};
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
class _LIBCPP_VISIBLE reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@@ -431,8 +350,7 @@ private:
public:
// construct/copy/destroy
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
: __f_(_VSTD::addressof(__f)) {}
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
#endif
@@ -491,13 +409,13 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&&) = delete;
template <class _Tp> void cref(const _Tp&&) = delete;
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&&);// = delete;
template <class _Tp> void cref(const _Tp&&);// = delete;
template <class _Tp> void ref(const _Tp&& __t);// = delete;
template <class _Tp> void cref(const _Tp&& __t);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
@@ -505,111 +423,6 @@ template <class _Tp> void cref(const _Tp&&);// = delete;
#endif // _LIBCPP_HAS_NO_VARIADICS
#if _LIBCPP_STD_VER > 11
template <class _Tp1, class _Tp2 = void>
struct __is_transparent
{
private:
struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
public:
static const bool value = sizeof(__test<_Tp1>(0)) == 1;
};
#endif
// allocator_arg_t
struct _LIBCPP_TYPE_VIS_ONLY allocator_arg_t { };
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
extern const allocator_arg_t allocator_arg;
#else
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
#endif
// uses_allocator
template <class _Tp>
struct __has_allocator_type
{
private:
struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::allocator_type* = 0);
public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
struct __uses_allocator
: public integral_constant<bool,
is_convertible<_Alloc, typename _Tp::allocator_type>::value>
{
};
template <class _Tp, class _Alloc>
struct __uses_allocator<_Tp, _Alloc, false>
: public false_type
{
};
template <class _Tp, class _Alloc>
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator
: public __uses_allocator<_Tp, _Alloc>
{
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
// allocator construction
template <class _Tp, class _Alloc, class ..._Args>
struct __uses_alloc_ctor_imp
{
static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
static const bool __ic =
is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
static const int value = __ua ? 2 - __ic : 0;
};
template <class _Tp, class _Alloc, class ..._Args>
struct __uses_alloc_ctor
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
{};
template <class _Tp, class _Allocator, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
{
new (__storage) _Tp (_VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class _Allocator, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
{
new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class _Allocator, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
{
new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a);
}
template <class _Tp, class _Allocator, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __args)
{
__user_alloc_construct_impl(
__uses_alloc_ctor<_Tp, _Allocator>(),
__storage, __a, _VSTD::forward<_Args>(__args)...
);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_FUNCTIONAL_BASE

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -19,38 +19,23 @@
#include <cstdint>
#include <cctype>
#include <locale.h>
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
# include <support/win32/locale_win32.h>
#elif _AIX
# include <support/ibm/xlocale.h>
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)
# include <xlocale.h>
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
#include <xlocale.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS locale;
class locale;
template <class _Facet>
_LIBCPP_INLINE_VISIBILITY
bool
has_facet(const locale&) _NOEXCEPT;
template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
template <class _Facet> const _Facet& use_facet(const locale&);
template <class _Facet>
_LIBCPP_INLINE_VISIBILITY
const _Facet&
use_facet(const locale&);
class _LIBCPP_TYPE_VIS locale
class _LIBCPP_VISIBLE locale
{
public:
// types:
class _LIBCPP_TYPE_VIS facet;
class _LIBCPP_TYPE_VIS id;
class facet;
class id;
typedef int category;
static const category // values assigned here are for exposition only
@@ -105,7 +90,7 @@ private:
template <class _Facet> friend const _Facet& use_facet(const locale&);
};
class _LIBCPP_TYPE_VIS locale::facet
class _LIBCPP_VISIBLE locale::facet
: public __shared_count
{
protected:
@@ -121,14 +106,14 @@ private:
virtual void __on_zero_shared() _NOEXCEPT;
};
class _LIBCPP_TYPE_VIS locale::id
class _LIBCPP_VISIBLE locale::id
{
once_flag __flag_;
int32_t __id_;
static int32_t __next_id;
public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
_LIBCPP_INLINE_VISIBILITY id() {}
private:
void __init();
void operator=(const id&); // = delete;
@@ -177,7 +162,7 @@ use_facet(const locale& __l)
// template <class _CharT> class collate;
template <class _CharT>
class _LIBCPP_TYPE_VIS_ONLY collate
class _LIBCPP_VISIBLE collate
: public locale::facet
{
public:
@@ -242,29 +227,29 @@ collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
template <class _CharT>
long
collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
{
size_t __h = 0;
const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t __mask = size_t(0xF) << (__sr + 4);
for(const char_type* __p = __lo; __p != __hi; ++__p)
size_t h = 0;
const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t mask = size_t(0xF) << (sr + 4);
for(const char_type* p = lo; p != hi; ++p)
{
__h = (__h << 4) + static_cast<size_t>(*__p);
size_t __g = __h & __mask;
__h ^= __g | (__g >> __sr);
h = (h << 4) + *p;
size_t g = h & mask;
h ^= g | (g >> sr);
}
return static_cast<long>(__h);
return static_cast<long>(h);
}
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<char>)
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<wchar_t>)
extern template class _LIBCPP_VISIBLE collate<char>;
extern template class _LIBCPP_VISIBLE collate<wchar_t>;
// template <class CharT> class collate_byname;
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY collate_byname;
template <class _CharT> class _LIBCPP_VISIBLE collate_byname;
template <>
class _LIBCPP_TYPE_VIS collate_byname<char>
class _LIBCPP_VISIBLE collate_byname<char>
: public collate<char>
{
locale_t __l;
@@ -283,7 +268,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS collate_byname<wchar_t>
class _LIBCPP_VISIBLE collate_byname<wchar_t>
: public collate<wchar_t>
{
locale_t __l;
@@ -314,11 +299,27 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
// template <class charT> class ctype
class _LIBCPP_TYPE_VIS ctype_base
class _LIBCPP_VISIBLE ctype_base
{
public:
#ifdef __GLIBC__
typedef unsigned short mask;
#else
typedef __uint32_t mask;
#endif
#if __APPLE__
static const mask space = _CTYPE_S;
static const mask print = _CTYPE_R;
static const mask cntrl = _CTYPE_C;
static const mask upper = _CTYPE_U;
static const mask lower = _CTYPE_L;
static const mask alpha = _CTYPE_A;
static const mask digit = _CTYPE_D;
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B;
#else // __APPLE__
static const mask space = _ISspace;
static const mask print = _ISprint;
static const mask cntrl = _IScntrl;
@@ -329,75 +330,17 @@ public:
static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit;
static const mask blank = _ISblank;
#elif defined(_WIN32)
typedef unsigned short mask;
static const mask space = _SPACE;
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
static const mask cntrl = _CONTROL;
static const mask upper = _UPPER;
static const mask lower = _LOWER;
static const mask alpha = _ALPHA;
static const mask digit = _DIGIT;
static const mask punct = _PUNCT;
static const mask xdigit = _HEX;
static const mask blank = _BLANK;
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#ifdef __APPLE__
typedef __uint32_t mask;
#elif defined(__FreeBSD__)
typedef unsigned long mask;
#elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
typedef unsigned short mask;
#endif
static const mask space = _CTYPE_S;
static const mask print = _CTYPE_R;
static const mask cntrl = _CTYPE_C;
static const mask upper = _CTYPE_U;
static const mask lower = _CTYPE_L;
static const mask alpha = _CTYPE_A;
static const mask digit = _CTYPE_D;
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
# if defined(__NetBSD__)
static const mask blank = _CTYPE_BL;
# else
static const mask blank = _CTYPE_B;
# endif
#elif defined(__sun__) || defined(_AIX)
typedef unsigned int mask;
static const mask space = _ISSPACE;
static const mask print = _ISPRINT;
static const mask cntrl = _ISCNTRL;
static const mask upper = _ISUPPER;
static const mask lower = _ISLOWER;
static const mask alpha = _ISALPHA;
static const mask digit = _ISDIGIT;
static const mask punct = _ISPUNCT;
static const mask xdigit = _ISXDIGIT;
static const mask blank = _ISBLANK;
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || __EMSCRIPTEN__ || __sun__
typedef unsigned long mask;
static const mask space = 1<<0;
static const mask print = 1<<1;
static const mask cntrl = 1<<2;
static const mask upper = 1<<3;
static const mask lower = 1<<4;
static const mask alpha = 1<<5;
static const mask digit = 1<<6;
static const mask punct = 1<<7;
static const mask xdigit = 1<<8;
static const mask blank = 1<<9;
#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
#endif // __APPLE__
static const mask alnum = alpha | digit;
static const mask graph = alnum | punct;
_LIBCPP_ALWAYS_INLINE ctype_base() {}
};
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype;
template <class _CharT> class _LIBCPP_VISIBLE ctype;
template <>
class _LIBCPP_TYPE_VIS ctype<wchar_t>
class _LIBCPP_VISIBLE ctype<wchar_t>
: public locale::facet,
public ctype_base
{
@@ -499,7 +442,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS ctype<char>
class _LIBCPP_VISIBLE ctype<char>
: public locale::facet, public ctype_base
{
const mask* __tab_;
@@ -512,14 +455,14 @@ public:
_LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const
{
return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
return isascii(__c) ? __tab_[__c] & __m : false;
}
_LIBCPP_ALWAYS_INLINE
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
{
for (; __low != __high; ++__low, ++__vec)
*__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
*__vec = isascii(*__low) ? __tab_[*__low] : 0;
return __low;
}
@@ -527,7 +470,7 @@ public:
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
{
for (; __low != __high; ++__low)
if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
if (isascii(*__low) && (__tab_[*__low] & __m))
break;
return __low;
}
@@ -536,7 +479,7 @@ public:
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
{
for (; __low != __high; ++__low)
if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
if (!(isascii(*__low) && (__tab_[*__low] & __m)))
break;
return __low;
}
@@ -598,14 +541,10 @@ public:
#endif
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
static const mask* classic_table() _NOEXCEPT;
#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT;
#endif
#if defined(__NetBSD__)
static const short* __classic_upper_table() _NOEXCEPT;
static const short* __classic_lower_table() _NOEXCEPT;
#endif
protected:
~ctype();
@@ -621,10 +560,10 @@ protected:
// template <class CharT> class ctype_byname;
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype_byname;
template <class _CharT> class _LIBCPP_VISIBLE ctype_byname;
template <>
class _LIBCPP_TYPE_VIS ctype_byname<char>
class _LIBCPP_VISIBLE ctype_byname<char>
: public ctype<char>
{
locale_t __l;
@@ -642,7 +581,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS ctype_byname<wchar_t>
class _LIBCPP_VISIBLE ctype_byname<wchar_t>
: public ctype<wchar_t>
{
locale_t __l;
@@ -773,7 +712,7 @@ tolower(_CharT __c, const locale& __loc)
// codecvt_base
class _LIBCPP_TYPE_VIS codecvt_base
class _LIBCPP_VISIBLE codecvt_base
{
public:
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
@@ -782,12 +721,12 @@ public:
// template <class internT, class externT, class stateT> class codecvt;
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TYPE_VIS_ONLY codecvt;
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_VISIBLE codecvt;
// template <> class codecvt<char, char, mbstate_t>
template <>
class _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<char, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -873,7 +812,7 @@ protected:
// template <> class codecvt<wchar_t, char, mbstate_t>
template <>
class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<wchar_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -956,7 +895,7 @@ protected:
// template <> class codecvt<char16_t, char, mbstate_t>
template <>
class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<char16_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -1042,7 +981,7 @@ protected:
// template <> class codecvt<char32_t, char, mbstate_t>
template <>
class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<char32_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -1128,7 +1067,7 @@ protected:
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
template <class _InternT, class _ExternT, class _StateT>
class _LIBCPP_TYPE_VIS_ONLY codecvt_byname
class _LIBCPP_VISIBLE codecvt_byname
: public codecvt<_InternT, _ExternT, _StateT>
{
public:
@@ -1147,14 +1086,14 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
{
}
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
extern template class codecvt_byname<char, char, mbstate_t>;
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_FUNC_VIS void __throw_runtime_error(const char*);
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
template <size_t _Np>
template <size_t _N>
struct __narrow_to_utf8
{
template <class _OutputIterator, class _CharT>
@@ -1244,7 +1183,7 @@ struct __narrow_to_utf8<32>
}
};
template <size_t _Np>
template <size_t _N>
struct __widen_from_utf8
{
template <class _OutputIterator>
@@ -1336,10 +1275,10 @@ struct __widen_from_utf8<32>
// template <class charT> class numpunct
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct;
template <class _CharT> class _LIBCPP_VISIBLE numpunct;
template <>
class _LIBCPP_TYPE_VIS numpunct<char>
class _LIBCPP_VISIBLE numpunct<char>
: public locale::facet
{
public:
@@ -1370,7 +1309,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS numpunct<wchar_t>
class _LIBCPP_VISIBLE numpunct<wchar_t>
: public locale::facet
{
public:
@@ -1402,10 +1341,10 @@ protected:
// template <class charT> class numpunct_byname
template <class charT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname;
template <class charT> class _LIBCPP_VISIBLE numpunct_byname;
template <>
class _LIBCPP_TYPE_VIS numpunct_byname<char>
class _LIBCPP_VISIBLE numpunct_byname<char>
: public numpunct<char>
{
public:
@@ -1423,7 +1362,7 @@ private:
};
template <>
class _LIBCPP_TYPE_VIS numpunct_byname<wchar_t>
class _LIBCPP_VISIBLE numpunct_byname<wchar_t>
: public numpunct<wchar_t>
{
public:

View File

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

View File

@@ -6,11 +6,7 @@
#include <type_traits>
#include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -95,7 +91,7 @@ public:
void reserve(size_type __n);
void shrink_to_fit() _NOEXCEPT;
void push_front(const_reference __x);
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
void push_back(const_reference __x);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
void push_front(value_type&& __x);
void push_back(value_type&& __x);
@@ -133,10 +129,8 @@ public:
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT
{__destruct_at_end(__new_last, false_type());}
_LIBCPP_INLINE_VISIBILITY
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
void swap(__split_buffer& __x)
@@ -147,14 +141,14 @@ public:
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer& __c, true_type)
void __move_assign_alloc(const __split_buffer& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
void __move_assign_alloc(const __split_buffer& __c, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
@@ -173,7 +167,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
{}
};
@@ -214,7 +208,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
__alloc_rr& __a = this->__alloc();
do
{
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), value_type());
++this->__end_;
--__n;
} while (__n > 0);
@@ -285,16 +279,16 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{
while (__begin_ != __new_begin)
__alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));
while (__begin_ < __new_begin)
__alloc_traits::destroy(__alloc(), __begin_++);
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
{
@@ -302,16 +296,16 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_t
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
{
while (__new_last != __end_)
__alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));
while (__new_last < __end_)
__alloc_traits::destroy(__alloc(), --__end_);
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
{
@@ -320,7 +314,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
: __end_cap_(nullptr, __a)
: __end_cap_(0, __a)
{
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
__begin_ = __end_ = __first_ + __start;
@@ -328,24 +322,24 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0)
{
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
{
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
{
}
@@ -394,8 +388,8 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
__first_ = __alloc_traits::allocate(__alloc(), __cap);
__begin_ = __end_ = __first_;
__end_cap() = __first_ + __cap;
typedef move_iterator<iterator> _Ip;
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
typedef move_iterator<iterator> _I;
__construct_at_end(_I(__c.begin()), _I(__c.end()));
}
}
@@ -492,7 +486,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
}
else
{
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -523,7 +517,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
}
else
{
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -541,7 +535,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
{
@@ -556,7 +550,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
}
else
{
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -587,7 +581,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
}
else
{
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -620,7 +614,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
}
else
{
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -640,7 +634,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))

View File

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

View File

@@ -17,15 +17,11 @@
#include <__locale>
#include <cstdio>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
static const int __limit = 8;
static const unsigned __limit = 8;
// __stdinbuf
@@ -41,7 +37,7 @@ public:
typedef typename traits_type::off_type off_type;
typedef typename traits_type::state_type state_type;
__stdinbuf(FILE* __fp, state_type* __st);
explicit __stdinbuf(FILE* __fp);
protected:
virtual int_type underflow();
@@ -53,10 +49,8 @@ private:
FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_;
state_type* __st_;
state_type __st_;
int __encoding_;
int_type __last_consumed_;
bool __last_consumed_is_next_;
bool __always_noconv_;
__stdinbuf(const __stdinbuf&);
@@ -66,11 +60,9 @@ private:
};
template <class _CharT>
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st)
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp)
: __file_(__fp),
__st_(__st),
__last_consumed_(traits_type::eof()),
__last_consumed_is_next_(false)
__st_()
{
imbue(this->getloc());
}
@@ -104,21 +96,11 @@ template <class _CharT>
typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::__getchar(bool __consume)
{
if (__last_consumed_is_next_)
{
int_type __result = __last_consumed_;
if (__consume)
{
__last_consumed_ = traits_type::eof();
__last_consumed_is_next_ = false;
}
return __result;
}
char __extbuf[__limit];
int __nread = _VSTD::max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i)
{
int __c = getc(__file_);
char __c = getc(__file_);
if (__c == EOF)
return traits_type::eof();
__extbuf[__i] = static_cast<char>(__c);
@@ -133,19 +115,19 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
codecvt_base::result __r;
do
{
state_type __sv_st = *__st_;
__r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt,
state_type __sv_st = __st_;
__r = __cv_->in(__st_, __extbuf, __extbuf + __nread, __enxt,
&__1buf, &__1buf + 1, __inxt);
switch (__r)
{
case _VSTD::codecvt_base::ok:
break;
case codecvt_base::partial:
*__st_ = __sv_st;
__st_ = __sv_st;
if (__nread == sizeof(__extbuf))
return traits_type::eof();
{
int __c = getc(__file_);
char __c = getc(__file_);
if (__c == EOF)
return traits_type::eof();
__extbuf[__nread] = static_cast<char>(__c);
@@ -164,12 +146,10 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
{
for (int __i = __nread; __i > 0;)
{
if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF)
if (ungetc(__extbuf[--__i], __file_) == EOF)
return traits_type::eof();
}
}
else
__last_consumed_ = traits_type::to_int_type(__1buf);
return traits_type::to_int_type(__1buf);
}
@@ -178,41 +158,28 @@ typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::pbackfail(int_type __c)
{
if (traits_type::eq_int_type(__c, traits_type::eof()))
{
if (!__last_consumed_is_next_)
{
__c = __last_consumed_;
__last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_,
traits_type::eof());
}
return __c;
}
if (__last_consumed_is_next_)
char __extbuf[__limit];
char* __enxt;
const char_type __ci = traits_type::to_char_type(__c);
const char_type* __inxt;
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
{
char __extbuf[__limit];
char* __enxt;
const char_type __ci = traits_type::to_char_type(__last_consumed_);
const char_type* __inxt;
switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
{
case _VSTD::codecvt_base::ok:
break;
case _VSTD::codecvt_base::noconv:
__extbuf[0] = static_cast<char>(__last_consumed_);
__enxt = __extbuf + 1;
break;
case codecvt_base::partial:
case codecvt_base::error:
return traits_type::eof();
}
while (__enxt > __extbuf)
if (ungetc(*--__enxt, __file_) == EOF)
return traits_type::eof();
case _VSTD::codecvt_base::ok:
break;
case _VSTD::codecvt_base::noconv:
__extbuf[0] = static_cast<char>(__c);
__enxt = __extbuf + 1;
break;
case codecvt_base::partial:
case codecvt_base::error:
return traits_type::eof();
}
__last_consumed_ = __c;
__last_consumed_is_next_ = true;
return __c;
while (__enxt > __extbuf)
if (ungetc(*--__enxt, __file_) == EOF)
return traits_type::eof();
return traits_type::not_eof(__c);
}
// __stdoutbuf
@@ -229,18 +196,17 @@ public:
typedef typename traits_type::off_type off_type;
typedef typename traits_type::state_type state_type;
__stdoutbuf(FILE* __fp, state_type* __st);
explicit __stdoutbuf(FILE* __fp);
protected:
virtual int_type overflow (int_type __c = traits_type::eof());
virtual streamsize xsputn(const char_type* __s, streamsize __n);
virtual int sync();
virtual void imbue(const locale& __loc);
private:
FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_;
state_type* __st_;
state_type __st_;
bool __always_noconv_;
__stdoutbuf(const __stdoutbuf&);
@@ -248,10 +214,10 @@ private:
};
template <class _CharT>
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st)
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp)
: __file_(__fp),
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
__st_(__st),
__st_(),
__always_noconv_(__cv_->always_noconv())
{
}
@@ -264,31 +230,30 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
char_type __1buf;
if (!traits_type::eq_int_type(__c, traits_type::eof()))
{
__1buf = traits_type::to_char_type(__c);
this->setp(&__1buf, &__1buf+1);
*this->pptr() = traits_type::to_char_type(__c);
this->pbump(1);
if (__always_noconv_)
{
if (fwrite(&__1buf, sizeof(char_type), 1, __file_) != 1)
if (fwrite(this->pbase(), sizeof(char_type), 1, __file_) != 1)
return traits_type::eof();
}
else
{
char* __extbe = __extbuf;
codecvt_base::result __r;
char_type* pbase = &__1buf;
char_type* pptr = pbase + 1;
char_type* epptr = pptr;
do
{
const char_type* __e;
__r = __cv_->out(*__st_, pbase, pptr, __e,
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
__extbuf,
__extbuf + sizeof(__extbuf),
__extbe);
if (__e == pbase)
if (__e == this->pbase())
return traits_type::eof();
if (__r == codecvt_base::noconv)
{
if (fwrite(pbase, 1, 1, __file_) != 1)
if (fwrite(this->pbase(), 1, 1, __file_) != 1)
return traits_type::eof();
}
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
@@ -298,30 +263,19 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
return traits_type::eof();
if (__r == codecvt_base::partial)
{
pbase = (char_type*)__e;
this->setp((char_type*)__e, this->pptr());
this->pbump(this->epptr() - this->pbase());
}
}
else
return traits_type::eof();
} while (__r == codecvt_base::partial);
}
this->setp(0, 0);
}
return traits_type::not_eof(__c);
}
template <class _CharT>
streamsize
__stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n)
{
if (__always_noconv_)
return fwrite(__s, sizeof(char_type), __n, __file_);
streamsize __i = 0;
for (; __i < __n; ++__i, ++__s)
if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof())
break;
return __i;
}
template <class _CharT>
int
__stdoutbuf<_CharT>::sync()
@@ -331,7 +285,7 @@ __stdoutbuf<_CharT>::sync()
do
{
char* __extbe;
__r = __cv_->unshift(*__st_, __extbuf,
__r = __cv_->unshift(__st_, __extbuf,
__extbuf + sizeof(__extbuf),
__extbe);
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);

View File

@@ -17,25 +17,23 @@
#include <stdexcept>
#include <algorithm>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Compare, class _Allocator> class __tree;
template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS_ONLY __tree_iterator;
class _LIBCPP_VISIBLE __tree_iterator;
template <class _Tp, class _ConstNodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
class _LIBCPP_VISIBLE __tree_const_iterator;
template <class _Key, class _Tp, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY map;
class _LIBCPP_VISIBLE map;
template <class _Key, class _Tp, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY multimap;
class _LIBCPP_VISIBLE multimap;
template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY set;
class _LIBCPP_VISIBLE set;
template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY multiset;
class _LIBCPP_VISIBLE multiset;
/*
@@ -614,11 +612,11 @@ public:
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
};
template <class _TreeIterator> class _LIBCPP_TYPE_VIS_ONLY __map_iterator;
template <class _TreeIterator> class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
template <class _TreeIterator> class __map_iterator;
template <class _TreeIterator> class __map_const_iterator;
template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS_ONLY __tree_iterator
class _LIBCPP_VISIBLE __tree_iterator
{
typedef _NodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
@@ -641,15 +639,10 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
: __ptr_(nullptr)
#endif
{}
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const
{return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator& operator++()
@@ -678,20 +671,20 @@ private:
_LIBCPP_INLINE_VISIBILITY
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
template <class, class, class> friend class __tree;
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_iterator;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY set;
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multiset;
template <class, class, class> friend class _LIBCPP_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 _Tp, class _ConstNodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator
class _LIBCPP_VISIBLE __tree_const_iterator
{
typedef _ConstNodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
typedef typename __node::base __node_base;
typedef const typename __node::base __node_base;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__node_base>
@@ -716,12 +709,7 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
: __ptr_(nullptr)
#endif
{}
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() {}
private:
typedef typename remove_const<__node>::type __non_const_node;
typedef typename pointer_traits<__node_pointer>::template
@@ -739,8 +727,7 @@ public:
: __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const
{return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator++()
@@ -770,11 +757,11 @@ private:
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
: __ptr_(__p) {}
template <class, class, class> friend class __tree;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY set;
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multiset;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
template <class, class, class, class> friend class _LIBCPP_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 _Tp, class _Compare, class _Allocator>
@@ -790,10 +777,8 @@ public:
typedef typename __alloc_traits::size_type size_type;
typedef typename __alloc_traits::difference_type difference_type;
typedef typename __alloc_traits::void_pointer __void_pointer;
typedef __tree_node<value_type, __void_pointer> __node;
typedef __tree_node_base<__void_pointer> __node_base;
typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>
@@ -803,9 +788,9 @@ public:
__node_allocator;
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::pointer __node_const_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer;
typedef typename __node_base::pointer __node_base_pointer;
typedef typename __node_base::pointer __node_base_const_pointer;
typedef typename __node_base::const_pointer __node_base_const_pointer;
private:
typedef typename __node_base::base __end_node_t;
typedef typename pointer_traits<__node_pointer>::template
@@ -817,9 +802,9 @@ private:
__end_node_ptr;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__end_node_t>
rebind<const __end_node_t>
#else
rebind<__end_node_t>::other
rebind<const __end_node_t>::other
#endif
__end_node_const_ptr;
@@ -841,7 +826,7 @@ public:
{
return static_cast<__node_const_pointer>
(
pointer_traits<__end_node_const_ptr>::pointer_to(const_cast<__end_node_t&>(__pair1_.first()))
pointer_traits<__end_node_const_ptr>::pointer_to(__pair1_.first())
);
}
_LIBCPP_INLINE_VISIBILITY
@@ -878,7 +863,7 @@ public:
{return static_cast<__node_const_pointer>(__end_node()->__left_);}
typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator;
typedef __tree_const_iterator<value_type, __node_const_pointer, difference_type> const_iterator;
explicit __tree(const value_compare& __comp)
_NOEXCEPT_(
@@ -945,14 +930,14 @@ public:
__emplace_hint_multi(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Vp>
pair<iterator, bool> __insert_unique(_Vp&& __v);
template <class _Vp>
iterator __insert_unique(const_iterator __p, _Vp&& __v);
template <class _Vp>
iterator __insert_multi(_Vp&& __v);
template <class _Vp>
iterator __insert_multi(const_iterator __p, _Vp&& __v);
template <class _V>
pair<iterator, bool> __insert_unique(_V&& __v);
template <class _V>
iterator __insert_unique(const_iterator __p, _V&& __v);
template <class _V>
iterator __insert_multi(_V&& __v);
template <class _V>
iterator __insert_multi(const_iterator __p, _V&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __insert_unique(const value_type& __v);
@@ -1034,8 +1019,8 @@ public:
pair<const_iterator, const_iterator>
__equal_range_multi(const _Key& __k) const;
typedef __tree_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _Dp> __node_holder;
typedef __tree_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _D> __node_holder;
__node_holder remove(const_iterator __p) _NOEXCEPT;
private:
@@ -1115,9 +1100,6 @@ private:
__node_pointer __detach();
static __node_pointer __detach(__node_pointer);
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
};
template <class _Tp, class _Compare, class _Allocator>
@@ -1177,7 +1159,7 @@ __tree<_Tp, _Compare, _Allocator>::__detach(__node_pointer __cache)
{
if (__cache->__parent_ == nullptr)
return nullptr;
if (__tree_is_left_child(static_cast<__node_base_pointer>(__cache)))
if (__tree_is_left_child(__cache))
{
__cache->__parent_->__left_ = nullptr;
__cache = static_cast<__node_pointer>(__cache->__parent_);
@@ -1310,7 +1292,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
__begin_node() = __end_node();
else
{
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
__end_node()->__left_->__parent_ = __end_node();
__t.__begin_node() = __t.__end_node();
__t.__end_node()->__left_ = nullptr;
__t.size() = 0;
@@ -1330,7 +1312,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __
{
__begin_node() = __t.__begin_node();
__end_node()->__left_ = __t.__end_node()->__left_;
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
__end_node()->__left_->__parent_ = __end_node();
size() = __t.size();
__t.__begin_node() = __t.__end_node();
__t.__end_node()->__left_ = nullptr;
@@ -1358,7 +1340,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
__begin_node() = __end_node();
else
{
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
__end_node()->__left_->__parent_ = __end_node();
__t.__begin_node() = __t.__end_node();
__t.__end_node()->__left_ = nullptr;
__t.size() = 0;
@@ -1463,11 +1445,11 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
if (size() == 0)
__begin_node() = __end_node();
else
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
__end_node()->__left_->__parent_ = __end_node();
if (__t.size() == 0)
__t.__begin_node() = __t.__end_node();
else
__t.__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__t.__end_node());
__t.__end_node()->__left_->__parent_ = __t.__end_node();
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1499,7 +1481,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__right_;
}
}
@@ -1509,13 +1491,13 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__left_;
}
}
}
}
__parent = static_cast<__node_base_pointer>(__end_node());
__parent = __end_node();
return __parent->__left_;
}
@@ -1538,7 +1520,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointe
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__left_;
}
}
@@ -1548,13 +1530,13 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointe
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__right_;
}
}
}
}
__parent = static_cast<__node_base_pointer>(__end_node());
__parent = __end_node();
return __parent->__left_;
}
@@ -1579,12 +1561,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
// *prev(__hint) <= __v <= *__hint
if (__hint.__ptr_->__left_ == nullptr)
{
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
return __parent->__left_;
}
else
{
__parent = static_cast<__node_base_pointer>(__prior.__ptr_);
__parent = const_cast<__node_pointer&>(__prior.__ptr_);
return __parent->__right_;
}
}
@@ -1616,7 +1598,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& _
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__left_;
}
}
@@ -1626,18 +1608,18 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& _
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__right_;
}
}
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent;
}
}
}
__parent = static_cast<__node_base_pointer>(__end_node());
__parent = __end_node();
return __parent->__left_;
}
@@ -1664,12 +1646,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
// *prev(__hint) < __v < *__hint
if (__hint.__ptr_->__left_ == nullptr)
{
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
return __parent->__left_;
}
else
{
__parent = static_cast<__node_base_pointer>(__prior.__ptr_);
__parent = const_cast<__node_pointer&>(__prior.__ptr_);
return __parent->__right_;
}
}
@@ -1685,12 +1667,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
// *__hint < __v < *_VSTD::next(__hint)
if (__hint.__ptr_->__right_ == nullptr)
{
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
return __parent->__right_;
}
else
{
__parent = static_cast<__node_base_pointer>(__next.__ptr_);
__parent = const_cast<__node_pointer&>(__next.__ptr_);
return __parent->__left_;
}
}
@@ -1698,7 +1680,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
return __find_equal(__parent, __v);
}
// else __v == *__hint
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
return __parent;
}
@@ -1727,7 +1709,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
return __h;
@@ -1745,7 +1727,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args)
bool __inserted = false;
if (__child == nullptr)
{
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
__inserted = true;
}
@@ -1763,7 +1745,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Ar
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
}
return iterator(__r);
@@ -1777,7 +1759,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(static_cast<__node_pointer>(__h.release()));
}
@@ -1790,18 +1772,18 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(static_cast<__node_pointer>(__h.release()));
}
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Compare, class _Allocator>
template <class _Vp>
template <class _V>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
{
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
@@ -1809,11 +1791,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Vp>
template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v)
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
{
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
iterator __r = __node_insert_unique(__p, __h.get());
if (__r.__ptr_ == __h.get())
__h.release();
@@ -1821,26 +1803,26 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Vp>
template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v)
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
{
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(__h.release());
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Vp>
template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v)
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
{
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(__h.release());
}
@@ -1851,10 +1833,10 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _VSTD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1870,7 +1852,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
if (__child == nullptr)
{
__node_holder __h = __construct_node(__v);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
__inserted = true;
}
@@ -1887,7 +1869,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, const val
if (__child == nullptr)
{
__node_holder __h = __construct_node(__v);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
}
return iterator(__r);
@@ -1900,7 +1882,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const value_type& __v)
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __v);
__node_holder __h = __construct_node(__v);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(__h.release());
}
@@ -1911,7 +1893,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __v);
__node_holder __h = __construct_node(__v);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(__h.release());
}
@@ -1925,7 +1907,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
bool __inserted = false;
if (__child == nullptr)
{
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
__insert_node_at(__parent, __child, __nd);
__r = __nd;
__inserted = true;
}
@@ -1942,7 +1924,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(const_iterator __p,
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
__insert_node_at(__parent, __child, __nd);
__r = __nd;
}
return iterator(__r);
@@ -1954,7 +1936,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd)
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __nd->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
__insert_node_at(__parent, __child, __nd);
return iterator(__nd);
}
@@ -1965,7 +1947,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p,
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __nd->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
__insert_node_at(__parent, __child, __nd);
return iterator(__nd);
}
@@ -1973,7 +1955,7 @@ template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
{
__node_pointer __np = __p.__ptr_;
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
iterator __r(__np);
++__r;
if (__begin_node() == __np)
@@ -1993,7 +1975,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l)
{
while (__f != __l)
__f = erase(__f);
return iterator(__l.__ptr_);
return iterator(const_cast<__node_pointer>(__l.__ptr_));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2069,7 +2051,7 @@ template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
{
typedef pair<const_iterator, const_iterator> _Pp;
typedef pair<const_iterator, const_iterator> _P;
__node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root();
while (__rt != nullptr)
@@ -2176,7 +2158,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
{
typedef pair<iterator, iterator> _Pp;
typedef pair<iterator, iterator> _P;
__node_pointer __result = __end_node();
__node_pointer __rt = __root();
while (__rt != nullptr)
@@ -2189,13 +2171,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_);
else
return _Pp(iterator(__rt),
return _P(iterator(__rt),
iterator(
__rt->__right_ != nullptr ?
static_cast<__node_pointer>(__tree_min(__rt->__right_))
: __result));
}
return _Pp(iterator(__result), iterator(__result));
return _P(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2204,7 +2186,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
{
typedef pair<const_iterator, const_iterator> _Pp;
typedef pair<const_iterator, const_iterator> _P;
__node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root();
while (__rt != nullptr)
@@ -2217,13 +2199,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_);
else
return _Pp(const_iterator(__rt),
return _P(const_iterator(__rt),
const_iterator(
__rt->__right_ != nullptr ?
static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
: __result));
}
return _Pp(const_iterator(__result), const_iterator(__result));
return _P(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2232,7 +2214,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
{
typedef pair<iterator, iterator> _Pp;
typedef pair<iterator, iterator> _P;
__node_pointer __result = __end_node();
__node_pointer __rt = __root();
while (__rt != nullptr)
@@ -2245,10 +2227,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_);
else
return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
return _P(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
}
return _Pp(iterator(__result), iterator(__result));
return _P(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2257,7 +2239,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
{
typedef pair<const_iterator, const_iterator> _Pp;
typedef pair<const_iterator, const_iterator> _P;
__node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root();
while (__rt != nullptr)
@@ -2270,17 +2252,17 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_);
else
return _Pp(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
return _P(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
}
return _Pp(const_iterator(__result), const_iterator(__result));
return _P(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
{
__node_pointer __np = __p.__ptr_;
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
if (__begin_node() == __np)
{
if (__np->__right_ != nullptr)
@@ -2291,7 +2273,7 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
--size();
__tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np));
return __node_holder(__np, _Dp(__node_alloc()));
return __node_holder(__np, _D(__node_alloc()));
}
template <class _Tp, class _Compare, class _Allocator>

View File

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

View File

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

View File

@@ -1,29 +0,0 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifdef min
#if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
"before any Windows header. #undefing min")
#else
#warning: macro min is incompatible with C++. #undefing min
#endif
#undef min
#endif
#ifdef max
#if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
"before any Windows header. #undefing max")
#else
#warning: macro max is incompatible with C++. #undefing max
#endif
#undef max
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -55,18 +55,18 @@ struct array
// capacity:
constexpr size_type size() const noexcept;
constexpr size_type max_size() const noexcept;
constexpr bool empty() const noexcept;
bool empty() const noexcept;
// element access:
reference operator[](size_type n);
const_reference operator[](size_type n) const; // constexpr in C++14
const_reference at(size_type n) const; // constexpr in C++14
const_reference operator[](size_type n) const;
const_reference at(size_type n) const;
reference at(size_type n);
reference front();
const_reference front() const; // constexpr in C++14
const_reference front() const;
reference back();
const_reference back() const; // constexpr in C++14
const_reference back() const;
T* data() noexcept;
const T* data() const noexcept;
@@ -92,9 +92,9 @@ template <class T> class tuple_size;
template <int I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N>>;
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept;
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
} // std
@@ -111,14 +111,12 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexp
#include <cassert>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
struct _LIBCPP_TYPE_VIS_ONLY array
struct _LIBCPP_VISIBLE array
{
// types:
typedef array __self;
@@ -173,22 +171,22 @@ struct _LIBCPP_TYPE_VIS_ONLY array
// capacity:
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
/*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
/*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
bool empty() const _NOEXCEPT {return _Size == 0;}
// element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __elems_[__n];}
reference at(size_type __n);
_LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
const_reference at(size_type __n) const;
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return __elems_[0];}
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY
value_type* data() _NOEXCEPT {return __elems_;}
@@ -210,7 +208,6 @@ array<_Tp, _Size>::at(size_type __n)
}
template <class _Tp, size_t _Size>
_LIBCPP_CONSTEXPR_AFTER_CXX11
typename array<_Tp, _Size>::const_reference
array<_Tp, _Size>::at(size_type __n) const
{
@@ -224,7 +221,7 @@ array<_Tp, _Size>::at(size_type __n) const
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -232,7 +229,7 @@ operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -240,7 +237,7 @@ operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -248,7 +245,7 @@ operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -256,7 +253,7 @@ operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -264,7 +261,7 @@ operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -272,7 +269,7 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename enable_if
<
__is_swappable<_Tp>::value,
@@ -285,54 +282,51 @@ swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<array<_Tp, _Size> >
class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const array<_Tp, _Size> >
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, array<_Tp, _Size> >
class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
{
public:
typedef _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const array<_Tp, _Size> >
class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
{
public:
typedef const _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY inline
_Tp&
get(array<_Tp, _Size>& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
return __a.__elems_[_Ip];
return __a[_Ip];
}
template <size_t _Ip, class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY inline
const _Tp&
get(const array<_Tp, _Size>& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
return __a.__elems_[_Ip];
return __a[_Ip];
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <size_t _Ip, class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY inline
_Tp&&
get(array<_Tp, _Size>&& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
return _VSTD::move(__a.__elems_[_Ip]);
return _VSTD::move(__a[_Ip]);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -20,7 +20,6 @@ namespace chrono
{
template <class ToDuration, class Rep, class Period>
constexpr
ToDuration
duration_cast(const duration<Rep, Period>& fd);
@@ -30,9 +29,9 @@ template <class Rep>
struct duration_values
{
public:
static constexpr Rep zero();
static constexpr Rep max();
static constexpr Rep min();
static Rep zero();
static Rep max();
static Rep min();
};
// duration
@@ -47,9 +46,9 @@ public:
typedef Rep rep;
typedef Period period;
constexpr duration() = default;
duration() = default;
template <class Rep2>
constexpr explicit duration(const Rep2& r,
explicit duration(const Rep2& r,
typename enable_if
<
is_convertible<Rep2, rep>::value &&
@@ -59,7 +58,7 @@ public:
// conversions
template <class Rep2, class Period2>
constexpr duration(const duration<Rep2, Period2>& d,
duration(const duration<Rep2, Period2>& d,
typename enable_if
<
treat_as_floating_point<rep>::value ||
@@ -68,12 +67,12 @@ public:
// observer
constexpr rep count() const;
rep count() const;
// arithmetic
constexpr duration operator+() const;
constexpr duration operator-() const;
duration operator+() const;
duration operator-() const;
duration& operator++();
duration operator++(int);
duration& operator--();
@@ -87,9 +86,9 @@ public:
// special values
static constexpr duration zero();
static constexpr duration min();
static constexpr duration max();
static duration zero();
static duration min();
static duration max();
};
typedef duration<long long, nano> nanoseconds;
@@ -111,16 +110,16 @@ private:
duration d_; // exposition only
public:
time_point(); // has value "epoch" // constexpr in C++14
explicit time_point(const duration& d); // same as time_point() + d // constexpr in C++14
time_point(); // has value "epoch"
explicit time_point(const duration& d); // same as time_point() + d
// conversions
template <class Duration2>
time_point(const time_point<clock, Duration2>& t); // constexpr in C++14
time_point(const time_point<clock, Duration2>& t);
// observer
duration time_since_epoch() const; // constexpr in C++14
duration time_since_epoch() const;
// arithmetic
@@ -146,55 +145,43 @@ namespace chrono {
// duration arithmetic
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const Rep1& s, const duration<Rep2, Period>& d);
template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period>
operator/(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<Rep1, Rep2>::type
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration comparisons
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration_cast
template <class ToDuration, class Rep, class Period>
ToDuration duration_cast(const duration<Rep, Period>& d);
// time_point arithmetic (all constexpr in C++14)
// time_point arithmetic
template <class Clock, class Duration1, class Rep2, class Period2>
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
@@ -208,7 +195,7 @@ template <class Clock, class Duration1, class Duration2>
typename common_type<Duration1, Duration2>::type
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
// time_point comparisons (all constexpr in C++14)
// time_point comparisons
template <class Clock, class Duration1, class Duration2>
bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
template <class Clock, class Duration1, class Duration2>
@@ -222,7 +209,7 @@ template <class Clock, class Duration1, class Duration2>
template <class Clock, class Duration1, class Duration2>
bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
// time_point_cast (constexpr in C++14)
// time_point_cast
template <class ToDuration, class Clock, class Duration>
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
@@ -236,7 +223,7 @@ public:
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock> time_point;
static const bool is_steady = false; // constexpr in C++14
static const bool is_steady = false;
static time_point now() noexcept;
static time_t to_time_t (const time_point& __t) noexcept;
@@ -250,7 +237,7 @@ public:
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<steady_clock, duration> time_point;
static const bool is_steady = true; // constexpr in C++14
static const bool is_steady = true;
static time_point now() noexcept;
};
@@ -259,19 +246,6 @@ typedef steady_clock high_resolution_clock;
} // chrono
constexpr chrono::hours operator "" h(unsigned long long); // C++14
constexpr chrono::duration<unspecified , ratio<3600,1>> operator "" h(long double); // C++14
constexpr chrono::minutes operator "" min(unsigned long long); // C++14
constexpr chrono::duration<unspecified , ratio<60,1>> operator "" min(long double); // C++14
constexpr chrono::seconds operator "" s(unsigned long long); // C++14
constexpr chrono::duration<unspecified > operator "" s(long double); // C++14
constexpr chrono::milliseconds operator "" ms(unsigned long long); // C++14
constexpr chrono::duration<unspecified , milli> operator "" ms(long double); // C++14
constexpr chrono::microseconds operator "" us(unsigned long long); // C++14
constexpr chrono::duration<unspecified , micro> operator "" us(long double); // C++14
constexpr chrono::nanoseconds operator "" ns(unsigned long long); // C++14
constexpr chrono::duration<unspecified , nano> operator "" ns(long double); // C++14
} // std
*/
@@ -281,18 +255,14 @@ constexpr chrono::duration<unspecified , nano> operator "" ns(long doub
#include <ratio>
#include <limits>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono
{
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TYPE_VIS_ONLY duration;
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_VISIBLE duration;
template <class _Tp>
struct __is_duration : false_type {};
@@ -312,8 +282,8 @@ struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
} // chrono
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::duration<_Rep1, _Period1>,
chrono::duration<_Rep2, _Period2> >
struct _LIBCPP_VISIBLE 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;
@@ -332,7 +302,7 @@ struct __duration_cast;
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const
{
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
@@ -342,7 +312,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const
{
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -354,7 +324,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const
{
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -366,7 +336,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const
{
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -378,7 +348,6 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
@@ -390,56 +359,25 @@ duration_cast(const duration<_Rep, _Period>& __fd)
}
template <class _Rep>
struct _LIBCPP_TYPE_VIS_ONLY treat_as_floating_point : is_floating_point<_Rep> {};
struct _LIBCPP_VISIBLE treat_as_floating_point : is_floating_point<_Rep> {};
template <class _Rep>
struct _LIBCPP_TYPE_VIS_ONLY duration_values
struct _LIBCPP_VISIBLE duration_values
{
public:
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();}
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
_LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();}
_LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();}
};
// duration
template <class _Rep, class _Period>
class _LIBCPP_TYPE_VIS_ONLY duration
class _LIBCPP_VISIBLE duration
{
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
static_assert(_Period::num > 0, "duration period must be positive");
template <class _R1, class _R2>
struct __no_overflow
{
private:
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
struct __mul // __overflow == false
{
static const intmax_t value = _Xp * _Yp;
};
template <intmax_t _Xp, intmax_t _Yp>
struct __mul<_Xp, _Yp, true>
{
static const intmax_t value = 1;
};
public:
static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
typedef ratio<__mul<__n1, __d2, !value>::value,
__mul<__n2, __d1, !value>::value> type;
};
public:
typedef _Rep rep;
typedef _Period period;
@@ -447,15 +385,9 @@ private:
rep __rep_;
public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
duration() = default;
#else
duration() {}
#endif
_LIBCPP_INLINE_VISIBILITY duration() {} // = default;
template <class _Rep2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_LIBCPP_INLINE_VISIBILITY
explicit duration(const _Rep2& __r,
typename enable_if
<
@@ -467,25 +399,24 @@ public:
// conversions
template <class _Rep2, class _Period2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_LIBCPP_INLINE_VISIBILITY
duration(const duration<_Rep2, _Period2>& __d,
typename enable_if
<
__no_overflow<_Period2, period>::value && (
treat_as_floating_point<rep>::value ||
(__no_overflow<_Period2, period>::type::den == 1 &&
!treat_as_floating_point<_Rep2>::value))
(ratio_divide<_Period2, period>::type::den == 1 &&
!treat_as_floating_point<_Rep2>::value)
>::type* = 0)
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
// observer
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
_LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
// arithmetic
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
_LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
_LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
@@ -501,9 +432,9 @@ public:
// special values
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values<rep>::min());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values<rep>::max());}
_LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
_LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());}
_LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values<rep>::max());}
};
typedef duration<long long, nano> nanoseconds;
@@ -518,8 +449,8 @@ typedef duration< long, ratio<3600> > hours;
template <class _LhsDuration, class _RhsDuration>
struct __duration_eq
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
return _Ct(__lhs).count() == _Ct(__rhs).count();
@@ -529,14 +460,13 @@ struct __duration_eq
template <class _LhsDuration>
struct __duration_eq<_LhsDuration, _LhsDuration>
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() == __rhs.count();}
};
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -547,7 +477,6 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -559,8 +488,8 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _LhsDuration, class _RhsDuration>
struct __duration_lt
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
return _Ct(__lhs).count() < _Ct(__rhs).count();
@@ -570,14 +499,13 @@ struct __duration_lt
template <class _LhsDuration>
struct __duration_lt<_LhsDuration, _LhsDuration>
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() < __rhs.count();}
};
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -588,7 +516,6 @@ operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -599,7 +526,6 @@ operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -610,7 +536,6 @@ operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -621,31 +546,30 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
__r += __rhs;
return __r;
}
// Duration -
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
__r -= __rhs;
return __r;
}
// Duration *
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if
<
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
@@ -654,13 +578,13 @@ typename enable_if
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef duration<_Cr, _Period> _Cd;
return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
duration<_Cr, _Period> __r = __d;
__r *= static_cast<_Cr>(__s);
return __r;
}
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if
<
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
@@ -699,18 +623,17 @@ struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef duration<_Cr, _Period> _Cd;
return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
duration<_Cr, _Period> __r = __d;
__r /= static_cast<_Cr>(__s);
return __r;
}
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<_Rep1, _Rep2>::type
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -722,24 +645,23 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef duration<_Cr, _Period> _Cd;
return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
duration<_Cr, _Period> __r = __d;
__r %= static_cast<_Cr>(__s);
return __r;
}
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
__r %= __rhs;
return __r;
}
//////////////////////////////////////////////////////////
@@ -747,7 +669,7 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
//////////////////////////////////////////////////////////
template <class _Clock, class _Duration = typename _Clock::duration>
class _LIBCPP_TYPE_VIS_ONLY time_point
class _LIBCPP_VISIBLE time_point
{
static_assert(__is_duration<_Duration>::value,
"Second template parameter of time_point must be a std::chrono::duration");
@@ -760,12 +682,12 @@ private:
duration __d_;
public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 time_point() : __d_(duration::zero()) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit time_point(const duration& __d) : __d_(__d) {}
_LIBCPP_INLINE_VISIBILITY time_point() : __d_(duration::zero()) {}
_LIBCPP_INLINE_VISIBILITY explicit time_point(const duration& __d) : __d_(__d) {}
// conversions
template <class _Duration2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
time_point(const time_point<clock, _Duration2>& t,
typename enable_if
<
@@ -775,24 +697,24 @@ public:
// observer
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 duration time_since_epoch() const {return __d_;}
_LIBCPP_INLINE_VISIBILITY duration time_since_epoch() const {return __d_;}
// arithmetic
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;}
// special values
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());}
_LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());}
_LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());}
};
} // chrono
template <class _Clock, class _Duration1, class _Duration2>
struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::time_point<_Clock, _Duration1>,
chrono::time_point<_Clock, _Duration2> >
struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
chrono::time_point<_Clock, _Duration2> >
{
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
};
@@ -800,7 +722,7 @@ struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::time_point<_Clock, _Duration1>,
namespace chrono {
template <class _ToDuration, class _Clock, class _Duration>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, _ToDuration>
time_point_cast(const time_point<_Clock, _Duration>& __t)
{
@@ -810,7 +732,7 @@ time_point_cast(const time_point<_Clock, _Duration>& __t)
// time_point ==
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -820,7 +742,7 @@ operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point !=
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -830,7 +752,7 @@ operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point <
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -840,7 +762,7 @@ operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point >
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -850,7 +772,7 @@ operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point <=
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -860,7 +782,7 @@ operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point >=
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -870,18 +792,20 @@ operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point operator+(time_point x, duration y);
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
return _Tr (__lhs.time_since_epoch() + __rhs);
_Tr __r(__lhs.time_since_epoch());
__r += __rhs;
return __r;
}
// time_point operator+(duration x, time_point y);
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -891,7 +815,7 @@ operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Dura
// time_point operator-(time_point x, duration y);
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -901,7 +825,7 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Pe
// duration operator-(time_point x, time_point y);
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
typename common_type<_Duration1, _Duration2>::type
operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -912,28 +836,28 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
/////////////////////// clocks ///////////////////////////
//////////////////////////////////////////////////////////
class _LIBCPP_TYPE_VIS system_clock
class _LIBCPP_VISIBLE system_clock
{
public:
typedef microseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock> time_point;
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
static const bool is_steady = false;
static time_point now() _NOEXCEPT;
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
static time_point from_time_t(time_t __t) _NOEXCEPT;
};
class _LIBCPP_TYPE_VIS steady_clock
class _LIBCPP_VISIBLE steady_clock
{
public:
typedef nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<steady_clock, duration> time_point;
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = true;
static const bool is_steady = true;
static time_point now() _NOEXCEPT;
};
@@ -942,86 +866,6 @@ typedef steady_clock high_resolution_clock;
} // chrono
#if _LIBCPP_STD_VER > 11
// Suffixes for duration literals [time.duration.literals]
inline namespace literals
{
inline namespace chrono_literals
{
constexpr chrono::hours operator"" h(unsigned long long __h)
{
return chrono::hours(static_cast<chrono::hours::rep>(__h));
}
constexpr chrono::duration<long double, ratio<3600,1>> operator"" h(long double __h)
{
return chrono::duration<long double, ratio<3600,1>>(__h);
}
constexpr chrono::minutes operator"" min(unsigned long long __m)
{
return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
}
constexpr chrono::duration<long double, ratio<60,1>> operator"" min(long double __m)
{
return chrono::duration<long double, ratio<60,1>> (__m);
}
constexpr chrono::seconds operator"" s(unsigned long long __s)
{
return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
}
constexpr chrono::duration<long double> operator"" s(long double __s)
{
return chrono::duration<long double> (__s);
}
constexpr chrono::milliseconds operator"" ms(unsigned long long __ms)
{
return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
}
constexpr chrono::duration<long double, milli> operator"" ms(long double __ms)
{
return chrono::duration<long double, milli>(__ms);
}
constexpr chrono::microseconds operator"" us(unsigned long long __us)
{
return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
}
constexpr chrono::duration<long double, micro> operator"" us(long double __us)
{
return chrono::duration<long double, micro> (__us);
}
constexpr chrono::nanoseconds operator"" ns(unsigned long long __ns)
{
return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
}
constexpr chrono::duration<long double, nano> operator"" ns(long double __ns)
{
return chrono::duration<long double, nano> (__ns);
}
}}
namespace chrono { // hoist the literals into namespace std::chrono
using namespace literals::chrono_literals;
}
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_CHRONO

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -29,8 +29,7 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
class codecvt_utf8
: public codecvt<Elem, char, mbstate_t>
{
explicit codecvt_utf8(size_t refs = 0);
~codecvt_utf8();
// unspecified
};
template <class Elem, unsigned long Maxcode = 0x10ffff,
@@ -38,8 +37,7 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
class codecvt_utf16
: public codecvt<Elem, char, mbstate_t>
{
explicit codecvt_utf16(size_t refs = 0);
~codecvt_utf16();
// unspecified
};
template <class Elem, unsigned long Maxcode = 0x10ffff,
@@ -47,8 +45,7 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
class codecvt_utf8_utf16
: public codecvt<Elem, char, mbstate_t>
{
explicit codecvt_utf8_utf16(size_t refs = 0);
~codecvt_utf8_utf16();
// unspecified
};
} // std
@@ -58,9 +55,7 @@ class codecvt_utf8_utf16
#include <__config>
#include <__locale>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -76,7 +71,7 @@ enum codecvt_mode
template <class _Elem> class __codecvt_utf8;
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
class __codecvt_utf8<wchar_t>
: public codecvt<wchar_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -111,7 +106,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
class __codecvt_utf8<char16_t>
: public codecvt<char16_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -146,7 +141,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
class __codecvt_utf8<char32_t>
: public codecvt<char32_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -182,7 +177,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8
class _LIBCPP_VISIBLE codecvt_utf8
: public __codecvt_utf8<_Elem>
{
public:
@@ -199,7 +194,7 @@ public:
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
class __codecvt_utf16<wchar_t, false>
: public codecvt<wchar_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -234,7 +229,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
class __codecvt_utf16<wchar_t, true>
: public codecvt<wchar_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -269,7 +264,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
class __codecvt_utf16<char16_t, false>
: public codecvt<char16_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -304,7 +299,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
class __codecvt_utf16<char16_t, true>
: public codecvt<char16_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -339,7 +334,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
class __codecvt_utf16<char32_t, false>
: public codecvt<char32_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -374,7 +369,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
class __codecvt_utf16<char32_t, true>
: public codecvt<char32_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -410,7 +405,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf16
class _LIBCPP_VISIBLE codecvt_utf16
: public __codecvt_utf16<_Elem, _Mode & little_endian>
{
public:
@@ -427,7 +422,7 @@ public:
template <class _Elem> class __codecvt_utf8_utf16;
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
class __codecvt_utf8_utf16<wchar_t>
: public codecvt<wchar_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -462,7 +457,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
class __codecvt_utf8_utf16<char32_t>
: public codecvt<char32_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -497,7 +492,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
class __codecvt_utf8_utf16<char16_t>
: public codecvt<char16_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -533,7 +528,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8_utf16
class _LIBCPP_VISIBLE codecvt_utf8_utf16
: public __codecvt_utf8_utf16<_Elem>
{
public:

View File

@@ -23,12 +23,12 @@ class complex
public:
typedef T value_type;
complex(const T& re = T(), const T& im = T()); // constexpr in C++14
complex(const complex&); // constexpr in C++14
template<class X> complex(const complex<X>&); // constexpr in C++14
complex(const T& re = T(), const T& im = T());
complex(const complex&);
template<class X> complex(const complex<X>&);
T real() const; // constexpr in C++14
T imag() const; // constexpr in C++14
T real() const;
T imag() const;
void real(T);
void imag(T);
@@ -149,12 +149,12 @@ template<class T> complex<T> operator/(const complex<T>&, const T&);
template<class T> complex<T> operator/(const T&, const complex<T>&);
template<class T> complex<T> operator+(const complex<T>&);
template<class T> complex<T> operator-(const complex<T>&);
template<class T> bool operator==(const complex<T>&, const complex<T>&); // constexpr in C++14
template<class T> bool operator==(const complex<T>&, const T&); // constexpr in C++14
template<class T> bool operator==(const T&, const complex<T>&); // constexpr in C++14
template<class T> bool operator!=(const complex<T>&, const complex<T>&); // constexpr in C++14
template<class T> bool operator!=(const complex<T>&, const T&); // constexpr in C++14
template<class T> bool operator!=(const T&, const complex<T>&); // constexpr in C++14
template<class T> bool operator==(const complex<T>&, const complex<T>&);
template<class T> bool operator==(const complex<T>&, const T&);
template<class T> bool operator==(const T&, const complex<T>&);
template<class T> bool operator!=(const complex<T>&, const complex<T>&);
template<class T> bool operator!=(const complex<T>&, const T&);
template<class T> bool operator!=(const T&, const complex<T>&);
template<class T, class charT, class traits>
basic_istream<charT, traits>&
@@ -165,17 +165,17 @@ template<class T, class charT, class traits>
// 26.3.7 values:
template<class T> T real(const complex<T>&); // constexpr in C++14
long double real(long double); // constexpr in C++14
double real(double); // constexpr in C++14
template<Integral T> double real(T); // constexpr in C++14
float real(float); // constexpr in C++14
template<class T> T real(const complex<T>&);
long double real(long double);
double real(double);
template<Integral T> double real(T);
float real(float);
template<class T> T imag(const complex<T>&); // constexpr in C++14
long double imag(long double); // constexpr in C++14
double imag(double); // constexpr in C++14
template<Integral T> double imag(T); // constexpr in C++14
float imag(float); // constexpr in C++14
template<class T> T imag(const complex<T>&);
long double imag(long double);
double imag(double);
template<Integral T> double imag(T);
float imag(float);
template<class T> T abs(const complex<T>&);
@@ -249,19 +249,17 @@ template<class T, class charT, class traits>
#include <cassert>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY complex;
template<class _Tp> class _LIBCPP_VISIBLE complex;
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY complex
class _LIBCPP_VISIBLE complex
{
public:
typedef _Tp value_type;
@@ -269,21 +267,20 @@ private:
value_type __re_;
value_type __im_;
public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
complex(const value_type& __re = value_type(), const value_type& __im = value_type())
: __re_(__re), __im_(__im) {}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
template<class _Xp> _LIBCPP_INLINE_VISIBILITY
complex(const complex<_Xp>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY value_type real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY value_type imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re)
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) {__re_ = __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -309,40 +306,39 @@ public:
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
{
*this = *this * complex(__c.real(), __c.imag());
*this = *this * __c;
return *this;
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
{
*this = *this / complex(__c.real(), __c.imag());
*this = *this / __c;
return *this;
}
};
template<> class _LIBCPP_TYPE_VIS_ONLY complex<double>;
template<> class _LIBCPP_TYPE_VIS_ONLY complex<long double>;
template<> class _LIBCPP_VISIBLE complex<double>;
template<> class _LIBCPP_VISIBLE complex<long double>;
template<>
class _LIBCPP_TYPE_VIS_ONLY complex<float>
class _LIBCPP_VISIBLE complex<float>
{
float __re_;
float __im_;
public:
typedef float value_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f)
: __re_(__re), __im_(__im) {}
explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
explicit /*constexpr*/ complex(const complex<double>& __c);
explicit /*constexpr*/ complex(const complex<long double>& __c);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re)
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) {__re_ = __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -368,37 +364,36 @@ public:
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
{
*this = *this * complex(__c.real(), __c.imag());
*this = *this * __c;
return *this;
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
{
*this = *this / complex(__c.real(), __c.imag());
*this = *this / __c;
return *this;
}
};
template<>
class _LIBCPP_TYPE_VIS_ONLY complex<double>
class _LIBCPP_VISIBLE complex<double>
{
double __re_;
double __im_;
public:
typedef double value_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0)
: __re_(__re), __im_(__im) {}
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
/*constexpr*/ complex(const complex<float>& __c);
explicit /*constexpr*/ complex(const complex<long double>& __c);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re)
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) {__re_ = __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -424,37 +419,36 @@ public:
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
{
*this = *this * complex(__c.real(), __c.imag());
*this = *this * __c;
return *this;
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
{
*this = *this / complex(__c.real(), __c.imag());
*this = *this / __c;
return *this;
}
};
template<>
class _LIBCPP_TYPE_VIS_ONLY complex<long double>
class _LIBCPP_VISIBLE complex<long double>
{
long double __re_;
long double __im_;
public:
typedef long double value_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L)
: __re_(__re), __im_(__im) {}
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
_LIBCPP_CONSTEXPR complex(const complex<double>& __c);
/*constexpr*/ complex(const complex<float>& __c);
/*constexpr*/ complex(const complex<double>& __c);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re)
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) {__re_ = __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -480,43 +474,43 @@ public:
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
{
*this = *this * complex(__c.real(), __c.imag());
*this = *this * __c;
return *this;
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
{
*this = *this / complex(__c.real(), __c.imag());
*this = *this / __c;
return *this;
}
};
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
@@ -740,7 +734,7 @@ operator-(const complex<_Tp>& __x)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
@@ -748,7 +742,7 @@ operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const complex<_Tp>& __x, const _Tp& __y)
{
@@ -756,7 +750,7 @@ operator==(const complex<_Tp>& __x, const _Tp& __y)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const _Tp& __x, const complex<_Tp>& __y)
{
@@ -764,7 +758,7 @@ operator==(const _Tp& __x, const complex<_Tp>& __y)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
@@ -772,7 +766,7 @@ operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const complex<_Tp>& __x, const _Tp& __y)
{
@@ -780,7 +774,7 @@ operator!=(const complex<_Tp>& __x, const _Tp& __y)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const _Tp& __x, const complex<_Tp>& __y)
{
@@ -792,21 +786,21 @@ operator!=(const _Tp& __x, const complex<_Tp>& __y)
// real
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
_Tp
real(const complex<_Tp>& __c)
{
return __c.real();
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
long double
real(long double __re)
{
return __re;
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
double
real(double __re)
{
@@ -814,7 +808,7 @@ real(double __re)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
@@ -825,7 +819,7 @@ real(_Tp __re)
return __re;
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
float
real(float __re)
{
@@ -835,21 +829,21 @@ real(float __re)
// imag
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
_Tp
imag(const complex<_Tp>& __c)
{
return __c.imag();
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
long double
imag(long double __re)
{
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
double
imag(double __re)
{
@@ -857,7 +851,7 @@ imag(double __re)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
@@ -868,7 +862,7 @@ imag(_Tp __re)
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
float
imag(float __re)
{
@@ -1249,12 +1243,10 @@ acosh(const complex<_Tp>& __x)
if (isnan(__x.imag()))
return complex<_Tp>(abs(__x.real()), __x.imag());
if (isinf(__x.imag()))
{
if (__x.real() > 0)
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
else
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
}
if (__x.real() < 0)
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
@@ -1353,11 +1345,7 @@ tanh(const complex<_Tp>& __x)
_Tp __2r(_Tp(2) * __x.real());
_Tp __2i(_Tp(2) * __x.imag());
_Tp __d(cosh(__2r) + cos(__2i));
_Tp __2rsh(sinh(__2r));
if (isinf(__2rsh) && isinf(__d))
return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
return complex<_Tp>(sinh(__2r)/__d, sin(__2i)/__d);
}
// asin
@@ -1521,47 +1509,6 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
return __os << __s.str();
}
#if _LIBCPP_STD_VER > 11
// Literal suffix for complex number literals [complex.literals]
inline namespace literals
{
inline namespace complex_literals
{
constexpr complex<long double> operator""il(long double __im)
{
return { 0.0l, __im };
}
constexpr complex<long double> operator""il(unsigned long long __im)
{
return { 0.0l, static_cast<long double>(__im) };
}
constexpr complex<double> operator""i(long double __im)
{
return { 0.0, static_cast<double>(__im) };
}
constexpr complex<double> operator""i(unsigned long long __im)
{
return { 0.0, static_cast<double>(__im) };
}
constexpr complex<float> operator""if(long double __im)
{
return { 0.0f, static_cast<float>(__im) };
}
constexpr complex<float> operator""if(unsigned long long __im)
{
return { 0.0f, static_cast<float>(__im) };
}
}
}
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_COMPLEX

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -74,7 +74,7 @@ int fputc(int c, FILE* stream);
int fputs(const char* restrict s, FILE* restrict stream);
int getc(FILE* stream);
int getchar(void);
char* gets(char* s); // removed in C++14
char* gets(char* s);
int putc(int c, FILE* stream);
int putchar(int c);
int puts(const char* s);
@@ -99,26 +99,7 @@ void perror(const char* s);
#include <__config>
#include <stdio.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
// snprintf
#if defined(_LIBCPP_MSVCRT)
#include "support/win32/support.h"
#endif
#ifdef getc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
#undef getc
inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
#endif // getc
#ifdef putc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
#undef putc
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
#endif // putc
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -143,24 +124,20 @@ using ::scanf;
using ::snprintf;
using ::sprintf;
using ::sscanf;
#ifndef _LIBCPP_MSVCRT
using ::vfprintf;
using ::vfscanf;
using ::vscanf;
using ::vsscanf;
#endif // _LIBCPP_MSVCRT
using ::vprintf;
using ::vscanf;
using ::vsnprintf;
using ::vsprintf;
using ::vsscanf;
using ::fgetc;
using ::fgets;
using ::fputc;
using ::fputs;
using ::getc;
using ::getchar;
#if _LIBCPP_STD_VER <= 11
using ::gets;
#endif
using ::putc;
using ::putchar;
using ::puts;

View File

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

View File

@@ -60,9 +60,7 @@ size_t strlen(const char* s);
#include <__config>
#include <string.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -93,8 +91,7 @@ using ::strspn;
using ::strstr;
// MSVCRT, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
#if !defined(__GLIBC__) && !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
#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);}

View File

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

View File

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

View File

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

View File

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

View File

@@ -41,7 +41,6 @@ public:
deque() noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit deque(const allocator_type& a);
explicit deque(size_type n);
explicit deque(size_type n, const allocator_type& a); // C++14
deque(size_type n, const value_type& v);
deque(size_type n, const value_type& v, const allocator_type& a);
template <class InputIterator>
@@ -151,9 +150,7 @@ template <class T, class Allocator>
*/
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include <__config>
#include <__split_buffer>
@@ -163,15 +160,13 @@ template <class T, class Allocator>
#include <algorithm>
#include <stdexcept>
#include <__undef_min_max>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Allocator> class __deque_base;
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator;
class _LIBCPP_VISIBLE __deque_iterator;
template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -263,7 +258,7 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator
class _LIBCPP_VISIBLE __deque_iterator
{
typedef _MapPointer __map_iterator;
public:
@@ -279,16 +274,12 @@ public:
typedef random_access_iterator_tag iterator_category;
typedef _Reference reference;
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
: __m_iter_(nullptr), __ptr_(nullptr)
#endif
{}
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {}
template <class _Pp, class _Rp, class _MP>
template <class _P, class _R, class _MP>
_LIBCPP_INLINE_VISIBILITY
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, __block_size>& __it,
typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT
__deque_iterator(const __deque_iterator<value_type, _P, _R, _MP, difference_type, __block_size>& __it,
typename enable_if<is_convertible<_P, pointer>::value>::type* = 0) _NOEXCEPT
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;}
@@ -414,10 +405,10 @@ private:
_LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
: __m_iter_(__m), __ptr_(__p) {}
template <class _Tp, class _Ap> friend class __deque_base;
template <class _Tp, class _Ap> friend class _LIBCPP_TYPE_VIS_ONLY deque;
template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
friend class _LIBCPP_TYPE_VIS_ONLY __deque_iterator;
template <class _Tp, class _A> friend class __deque_base;
template <class _Tp, class _A> friend class _LIBCPP_VISIBLE deque;
template <class _V, class _P, class _R, class _MP, class _D, _D>
friend class _LIBCPP_VISIBLE __deque_iterator;
template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -920,14 +911,7 @@ protected:
__pointer_allocator;
typedef allocator_traits<__pointer_allocator> __map_traits;
typedef typename __map_traits::pointer __map_pointer;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<const_pointer>
#else
rebind_alloc<const_pointer>::other
#endif
__const_pointer_allocator;
typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer;
typedef typename __map_traits::const_pointer __map_const_pointer;
typedef __split_buffer<pointer, __pointer_allocator> __map;
typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
@@ -993,14 +977,14 @@ protected:
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__deque_base& __c, true_type)
void __move_assign_alloc(const __deque_base& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__deque_base&, false_type) _NOEXCEPT
void __move_assign_alloc(const __deque_base& __c, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
@@ -1019,7 +1003,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type&, allocator_type&, false_type)
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
_NOEXCEPT
{}
};
@@ -1065,7 +1049,7 @@ template <class _Tp, class _Allocator>
typename __deque_base<_Tp, _Allocator>::const_iterator
__deque_base<_Tp, _Allocator>::begin() const _NOEXCEPT
{
__map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
__map_const_pointer __mp = __map_.begin() + __start_ / __block_size;
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
}
@@ -1083,7 +1067,7 @@ typename __deque_base<_Tp, _Allocator>::const_iterator
__deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
{
size_type __p = size() + __start_;
__map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
__map_const_pointer __mp = __map_.begin() + __p / __block_size;
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
}
@@ -1179,7 +1163,7 @@ __deque_base<_Tp, _Allocator>::clear() _NOEXCEPT
}
template <class _Tp, class _Allocator = allocator<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY deque
class _LIBCPP_VISIBLE deque
: private __deque_base<_Tp, _Allocator>
{
public:
@@ -1210,9 +1194,6 @@ public:
{}
_LIBCPP_INLINE_VISIBILITY deque(const allocator_type& __a) : __base(__a) {}
explicit deque(size_type __n);
#if _LIBCPP_STD_VER > 11
explicit deque(size_type __n, const _Allocator& __a);
#endif
deque(size_type __n, const value_type& __v);
deque(size_type __n, const value_type& __v, const allocator_type& __a);
template <class _InputIter>
@@ -1223,16 +1204,12 @@ public:
typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
deque(const deque& __c);
deque(const deque& __c, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
deque(initializer_list<value_type> __il);
deque(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
deque& operator=(const deque& __c);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
@@ -1250,10 +1227,8 @@ 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);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
allocator_type get_allocator() const _NOEXCEPT;
@@ -1338,11 +1313,9 @@ public:
template <class _BiIter>
iterator insert (const_iterator __p, _BiIter __f, _BiIter __l,
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, initializer_list<value_type> __il)
{return insert(__p, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void pop_front();
void pop_back();
iterator erase(const_iterator __p);
@@ -1356,8 +1329,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
bool __invariants() const {return __base::__invariants();}
private:
typedef typename __base::__map_const_pointer __map_const_pointer;
_LIBCPP_INLINE_VISIBILITY
static size_type __recommend_blocks(size_type __n)
{
@@ -1420,7 +1391,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const deque&, false_type)
void __copy_assign_alloc(const deque& __c, false_type)
{}
void __move_assign(deque& __c, true_type)
@@ -1435,16 +1406,6 @@ deque<_Tp, _Allocator>::deque(size_type __n)
__append(__n);
}
#if _LIBCPP_STD_VER > 11
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
: __base(__a)
{
if (__n > 0)
__append(__n);
}
#endif
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v)
{
@@ -1491,8 +1452,6 @@ deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a)
__append(__c.begin(), __c.end());
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
{
@@ -1506,8 +1465,6 @@ deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator
__append(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>&
deque<_Tp, _Allocator>::operator=(const deque& __c)
@@ -1537,8 +1494,8 @@ deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
{
if (__a != __c.__alloc())
{
typedef move_iterator<iterator> _Ip;
assign(_Ip(__c.begin()), _Ip(__c.end()));
typedef move_iterator<iterator> _I;
assign(_I(__c.begin()), _I(__c.end()));
}
}
@@ -1560,8 +1517,8 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type)
{
if (__base::__alloc() != __c.__alloc())
{
typedef move_iterator<iterator> _Ip;
assign(_Ip(__c.begin()), _Ip(__c.end()));
typedef move_iterator<iterator> _I;
assign(_I(__c.begin()), _I(__c.end()));
}
else
__move_assign(__c, true_type());
@@ -1993,7 +1950,6 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
}
else
{
value_type __tmp(_VSTD::forward<_Args>(__args)...);
iterator __b = __base::begin();
iterator __bm1 = _VSTD::prev(__b);
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
@@ -2001,7 +1957,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
++__base::size();
if (__pos > 1)
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
*__b = _VSTD::move(__tmp);
*__b = value_type(_VSTD::forward<_Args>(__args)...);
}
}
else
@@ -2017,14 +1973,13 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
}
else
{
value_type __tmp(_VSTD::forward<_Args>(__args)...);
iterator __e = __base::end();
iterator __em1 = _VSTD::prev(__e);
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _VSTD::move_backward(__e - __de, __em1, __e);
*--__e = _VSTD::move(__tmp);
*--__e = value_type(_VSTD::forward<_Args>(__args)...);
}
}
return __base::begin() + __pos;
@@ -2532,9 +2487,9 @@ void
deque<_Tp, _Allocator>::pop_front()
{
allocator_type& __a = __base::__alloc();
__alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
__base::__start_ / __base::__block_size) +
__base::__start_ % __base::__block_size));
__alloc_traits::destroy(__a, *(__base::__map_.begin() +
__base::__start_ / __base::__block_size) +
__base::__start_ % __base::__block_size);
--__base::size();
if (++__base::__start_ >= 2 * __base::__block_size)
{
@@ -2550,9 +2505,9 @@ deque<_Tp, _Allocator>::pop_back()
{
allocator_type& __a = __base::__alloc();
size_type __p = __base::size() + __base::__start_ - 1;
__alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
__p / __base::__block_size) +
__p % __base::__block_size));
__alloc_traits::destroy(__a, *(__base::__map_.begin() +
__p / __base::__block_size) +
__p % __base::__block_size);
--__base::size();
if (__back_spare() >= 2 * __base::__block_size)
{
@@ -2583,7 +2538,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __
__fe = __fb + __bs;
}
if (__fb <= __vt && __vt < __fe)
__vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
__vt = (const_iterator(__f.__m_iter_, __vt) -= __f - __r).__ptr_;
__r = _VSTD::move(__fb, __fe, __r);
__n -= __bs;
__f += __bs;
@@ -2614,7 +2569,7 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it
__lb = __le - __bs;
}
if (__lb <= __vt && __vt < __le)
__vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
__vt = (const_iterator(__l.__m_iter_, __vt) += __r - __l - 1).__ptr_;
__r = _VSTD::move_backward(__lb, __le, __r);
__n -= __bs;
__l -= __bs - 1;
@@ -2645,7 +2600,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
__fe = __fb + __bs;
}
if (__fb <= __vt && __vt < __fe)
__vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
__vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
__alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__fb));
__n -= __bs;
@@ -2681,7 +2636,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
__lb = __le - __bs;
}
if (__lb <= __vt && __vt < __le)
__vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
__vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
while (__le != __lb)
{
__alloc_traits::construct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__le));
@@ -2811,7 +2766,7 @@ deque<_Tp, _Allocator>::clear() _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2820,7 +2775,7 @@ operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2828,7 +2783,7 @@ operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2836,7 +2791,7 @@ operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2844,7 +2799,7 @@ operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2852,7 +2807,7 @@ operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2860,7 +2815,7 @@ operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))

View File

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

View File

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

View File

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

View File

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

View File

@@ -203,15 +203,8 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <__hash_table>
#include <functional>
#include <stdexcept>
#include <ext/__hash>
#if __DEPRECATED
#if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
#else
# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
#endif
#endif
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
#pragma GCC system_header
@@ -219,11 +212,7 @@ namespace __gnu_cxx {
using namespace std;
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value
#if __has_feature(is_final)
&& !__is_final(_Hash)
#endif
>
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value>
class __hash_map_hasher
: private _Hash
{
@@ -255,11 +244,7 @@ public:
{return __hash_(__x);}
};
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value
#if __has_feature(is_final)
&& !__is_final(_Pred)
#endif
>
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value>
class __hash_map_equal
: private _Pred
{
@@ -365,7 +350,7 @@ public:
};
template <class _HashIterator>
class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
class _LIBCPP_VISIBLE __hash_map_iterator
{
_HashIterator __i_;
@@ -408,15 +393,15 @@ public:
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
template <class, class, class, class, class> friend class _LIBCPP_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 _HashIterator>
class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
class _LIBCPP_VISIBLE __hash_map_const_iterator
{
_HashIterator __i_;
@@ -467,21 +452,20 @@ public:
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
template <class, class, class, class, class> friend class _LIBCPP_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 _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TYPE_VIS_ONLY hash_map
class _LIBCPP_VISIBLE hash_map
{
public:
// types
typedef _Key key_type;
typedef _Tp mapped_type;
typedef _Tp data_type;
typedef _Hash hasher;
typedef _Pred key_equal;
typedef _Alloc allocator_type;
@@ -511,8 +495,8 @@ private:
typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node;
typedef __hash_map_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _Dp> __node_holder;
typedef __hash_map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _D> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits;
public:
typedef typename __alloc_traits::pointer pointer;
@@ -565,8 +549,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
@@ -683,12 +665,12 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _VSTD::move(__h);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -754,13 +736,12 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TYPE_VIS_ONLY hash_multimap
class _LIBCPP_VISIBLE hash_multimap
{
public:
// types
typedef _Key key_type;
typedef _Tp mapped_type;
typedef _Tp data_type;
typedef _Hash hasher;
typedef _Pred key_equal;
typedef _Alloc allocator_type;
@@ -788,8 +769,8 @@ private:
typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node;
typedef __hash_map_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _Dp> __node_holder;
typedef __hash_map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _D> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits;
public:
typedef typename __alloc_traits::pointer pointer;
@@ -842,8 +823,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);

View File

@@ -196,23 +196,16 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__config>
#include <__hash_table>
#include <functional>
#include <ext/__hash>
#if __DEPRECATED
#if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
#else
# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
#endif
#endif
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
namespace __gnu_cxx {
using namespace std;
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
template <class _Value, class _Hash = std::hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_TYPE_VIS_ONLY hash_set
class _LIBCPP_VISIBLE hash_set
{
public:
// types
@@ -279,8 +272,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
@@ -433,7 +424,7 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_TYPE_VIS_ONLY hash_multiset
class _LIBCPP_VISIBLE hash_multiset
{
public:
// types
@@ -499,8 +490,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);

View File

@@ -38,7 +38,6 @@ public:
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit forward_list(const allocator_type& a);
explicit forward_list(size_type n);
explicit forward_list(size_type n, const allocator_type& a); // C++14
forward_list(size_type n, const value_type& v);
forward_list(size_type n, const value_type& v, const allocator_type& a);
template <class InputIterator>
@@ -175,11 +174,7 @@ template <class T, class Allocator>
#include <iterator>
#include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -213,11 +208,11 @@ struct __forward_list_node
value_type __value_;
};
template<class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS_ONLY forward_list;
template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
template<class _Tp, class _Alloc> class forward_list;
template<class _NodeConstPtr> class __forward_list_const_iterator;
template <class _NodePtr>
class _LIBCPP_TYPE_VIS_ONLY __forward_list_iterator
class _LIBCPP_VISIBLE __forward_list_iterator
{
typedef _NodePtr __node_pointer;
@@ -226,14 +221,14 @@ class _LIBCPP_TYPE_VIS_ONLY __forward_list_iterator
_LIBCPP_INLINE_VISIBILITY
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
template<class, class> friend class _LIBCPP_TYPE_VIS_ONLY forward_list;
template<class> friend class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
template<class, class> friend class forward_list;
template<class> friend class __forward_list_const_iterator;
public:
typedef forward_iterator_tag iterator_category;
typedef typename pointer_traits<__node_pointer>::element_type::value_type
value_type;
typedef value_type& reference;
typedef value_type& reference;
typedef typename pointer_traits<__node_pointer>::difference_type
difference_type;
typedef typename pointer_traits<__node_pointer>::template
@@ -250,7 +245,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__forward_list_iterator& operator++()
@@ -277,7 +272,7 @@ public:
};
template <class _NodeConstPtr>
class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator
class _LIBCPP_VISIBLE __forward_list_const_iterator
{
typedef _NodeConstPtr __node_const_pointer;
@@ -304,7 +299,7 @@ class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator
public:
typedef forward_iterator_tag iterator_category;
typedef typename __node::value_type value_type;
typedef const value_type& reference;
typedef const value_type& reference;
typedef typename pointer_traits<__node_const_pointer>::difference_type
difference_type;
typedef typename pointer_traits<__node_const_pointer>::template
@@ -324,7 +319,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator& operator++()
@@ -369,27 +364,18 @@ protected:
__node_allocator;
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::pointer __node_const_pointer;
typedef typename allocator_traits<allocator_type>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__begin_node>
#else
rebind_alloc<__begin_node>::other
#endif
__begin_node_allocator;
typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer;
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
_LIBCPP_INLINE_VISIBILITY
__node_pointer __before_begin() _NOEXCEPT
{return static_cast<__node_pointer>(pointer_traits<__begin_node_pointer>::
pointer_to(__before_begin_.first()));}
{return pointer_traits<__node_pointer>::pointer_to(
static_cast<__node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY
__node_const_pointer __before_begin() const _NOEXCEPT
{return static_cast<__node_const_pointer>(pointer_traits<__begin_node_pointer>::
pointer_to(const_cast<__begin_node&>(__before_begin_.first())));}
{return pointer_traits<__node_const_pointer>::pointer_to(
static_cast<const __node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY
__node_allocator& __alloc() _NOEXCEPT
@@ -399,7 +385,7 @@ protected:
{return __before_begin_.second();}
typedef __forward_list_iterator<__node_pointer> iterator;
typedef __forward_list_const_iterator<__node_pointer> const_iterator;
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
_LIBCPP_INLINE_VISIBILITY
__forward_list_base()
@@ -543,7 +529,7 @@ __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
}
template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY forward_list
class _LIBCPP_VISIBLE forward_list
: private __forward_list_base<_Tp, _Alloc>
{
typedef __forward_list_base<_Tp, _Alloc> base;
@@ -572,9 +558,6 @@ public:
{} // = default;
explicit forward_list(const allocator_type& __a);
explicit forward_list(size_type __n);
#if _LIBCPP_STD_VER > 11
explicit forward_list(size_type __n, const allocator_type& __a);
#endif
forward_list(size_type __n, const value_type& __v);
forward_list(size_type __n, const value_type& __v, const allocator_type& __a);
template <class _InputIterator>
@@ -597,10 +580,8 @@ public:
: base(_VSTD::move(__x)) {}
forward_list(forward_list&& __x, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
forward_list(initializer_list<value_type> __il);
forward_list(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~forward_list() = default;
@@ -611,9 +592,7 @@ public:
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
forward_list& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _InputIterator>
typename enable_if
@@ -623,9 +602,7 @@ public:
>::type
assign(_InputIterator __f, _InputIterator __l);
void assign(size_type __n, const value_type& __v);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void assign(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -700,10 +677,8 @@ public:
iterator
>::type
insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
{return insert_after(__p, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator erase_after(const_iterator __p);
iterator erase_after(const_iterator __f, const_iterator __l);
@@ -785,8 +760,8 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
__p = __p->__next_)
{
@@ -798,28 +773,6 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
}
}
#if _LIBCPP_STD_VER > 11
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __a)
: base ( __a )
{
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
__p = __p->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_));
__h->__next_ = nullptr;
__p->__next_ = __h.release();
}
}
}
#endif
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
{
@@ -883,15 +836,13 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
{
if (base::__alloc() != __x.__alloc())
{
typedef move_iterator<iterator> _Ip;
insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
typedef move_iterator<iterator> _I;
insert_after(cbefore_begin(), _I(__x.begin()), _I(__x.end()));
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
{
@@ -906,8 +857,6 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
insert_after(cbefore_begin(), __il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
@@ -941,8 +890,8 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
__move_assign(__x, true_type());
else
{
typedef move_iterator<iterator> _Ip;
assign(_Ip(__x.begin()), _Ip(__x.end()));
typedef move_iterator<iterator> _I;
assign(_I(__x.begin()), _I(__x.end()));
}
}
@@ -961,8 +910,6 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
forward_list<_Tp, _Alloc>&
@@ -972,8 +919,6 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
template <class _InputIterator>
typename enable_if
@@ -1009,8 +954,6 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
erase_after(__i, __e);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
@@ -1019,8 +962,6 @@ forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
assign(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -1030,8 +971,8 @@ void
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
_VSTD::forward<_Args>(__args)...);
__h->__next_ = base::__before_begin()->__next_;
@@ -1045,8 +986,8 @@ void
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
@@ -1059,8 +1000,8 @@ void
forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
@@ -1085,10 +1026,10 @@ template <class... _Args>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
{
__node_pointer const __r = __p.__ptr_;
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
_VSTD::forward<_Args>(__args)...);
__h->__next_ = __r->__next_;
@@ -1102,10 +1043,10 @@ template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
{
__node_pointer const __r = __p.__ptr_;
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
@@ -1118,10 +1059,10 @@ template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v)
{
__node_pointer const __r = __p.__ptr_;
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
@@ -1133,12 +1074,12 @@ typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
const value_type& __v)
{
__node_pointer __r = __p.__ptr_;
__node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
@@ -1183,12 +1124,12 @@ typename enable_if
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
_InputIterator __f, _InputIterator __l)
{
__node_pointer __r = __p.__ptr_;
__node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
if (__f != __l)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
@@ -1227,7 +1168,7 @@ template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
{
__node_pointer __p = __f.__ptr_;
__node_pointer __p = const_cast<__node_pointer>(__f.__ptr_);
__node_pointer __n = __p->__next_;
__p->__next_ = __n->__next_;
__node_allocator& __a = base::__alloc();
@@ -1240,10 +1181,10 @@ template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
{
__node_pointer __e = __l.__ptr_;
__node_pointer __e = const_cast<__node_pointer>(__l.__ptr_);
if (__f != __l)
{
__node_pointer __p = __f.__ptr_;
__node_pointer __p = const_cast<__node_pointer>(__f.__ptr_);
__node_pointer __n = __p->__next_;
if (__n != __e)
{
@@ -1279,8 +1220,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_)
{
@@ -1311,8 +1252,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_)
{
@@ -1337,10 +1278,12 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
const_iterator __lm1 = __x.before_begin();
while (__lm1.__ptr_->__next_ != nullptr)
++__lm1;
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
const_cast<__node_pointer>(__p.__ptr_)->__next_;
}
__p.__ptr_->__next_ = __x.__before_begin()->__next_;
__x.__before_begin()->__next_ = nullptr;
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
const_cast<__node_pointer>(__x.__before_begin())->__next_;
const_cast<__node_pointer>(__x.__before_begin())->__next_ = nullptr;
}
}
@@ -1353,9 +1296,12 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
const_iterator __lm1 = _VSTD::next(__i);
if (__p != __i && __p != __lm1)
{
__i.__ptr_->__next_ = __lm1.__ptr_->__next_;
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
__p.__ptr_->__next_ = __lm1.__ptr_;
const_cast<__node_pointer>(__i.__ptr_)->__next_ =
const_cast<__node_pointer>(__lm1.__ptr_)->__next_;
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
const_cast<__node_pointer>(__p.__ptr_)->__next_;
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
const_cast<__node_pointer>(__lm1.__ptr_);
}
}
@@ -1372,9 +1318,12 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
++__lm1;
if (__f != __lm1)
{
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
__p.__ptr_->__next_ = __f.__ptr_->__next_;
__f.__ptr_->__next_ = __l.__ptr_;
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
const_cast<__node_pointer>(__p.__ptr_)->__next_;
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
const_cast<__node_pointer>(__f.__ptr_)->__next_;
const_cast<__node_pointer>(__f.__ptr_)->__next_ =
const_cast<__node_pointer>(__l.__ptr_);
}
}
}
@@ -1596,12 +1545,12 @@ template <class _Tp, class _Alloc>
bool operator==(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
typedef forward_list<_Tp, _Alloc> _Cp;
typedef typename _Cp::const_iterator _Ip;
_Ip __ix = __x.begin();
_Ip __ex = __x.end();
_Ip __iy = __y.begin();
_Ip __ey = __y.end();
typedef forward_list<_Tp, _Alloc> _C;
typedef typename _C::const_iterator _I;
_I __ix = __x.begin();
_I __ex = __x.end();
_I __iy = __y.begin();
_I __ey = __y.end();
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
if (!(*__ix == *__iy))
return false;

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -14,8 +14,6 @@
/*
iomanip synopsis
namespace std {
// types T1, T2, ... are unspecified implementation types
T1 resetiosflags(ios_base::fmtflags mask);
T2 setiosflags (ios_base::fmtflags mask);
@@ -28,17 +26,6 @@ template <class charT, class moneyT> T8 put_money(const moneyT& mon, bool intl =
template <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
template <class charT>
T11 quoted(const charT* s, charT delim=charT('"'), charT escape=charT('\\')); // C++14
template <class charT, class traits, class Allocator>
T12 quoted(const basic_string<charT, traits, Allocator>& s,
charT delim=charT('"'), charT escape=charT('\\')); // C++14
template <class charT, class traits, class Allocator>
T13 quoted(basic_string<charT, traits, Allocator>& s,
charT delim=charT('"'), charT escape=charT('\\')); // C++14
} // std
*/
@@ -46,9 +33,7 @@ template <class charT, class traits, class Allocator>
#include <__config>
#include <istream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -290,10 +275,10 @@ public:
__iom_t7(_MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {}
template <class _CharT, class _Traits, class _Mp>
template <class _CharT, class _Traits, class _M>
friend
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_M>& __x);
};
template <class _CharT, class _Traits, class _MoneyT>
@@ -307,11 +292,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s)
{
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef money_get<_CharT, _Ip> _Fp;
typedef istreambuf_iterator<_CharT, _Traits> _I;
typedef money_get<_CharT, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
const _Fp& __mf = use_facet<_Fp>(__is.getloc());
__mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
const _F& __mf = use_facet<_F>(__is.getloc());
__mf.get(_I(__is), _I(), __x.__intl_, __is, __err, __x.__mon_);
__is.setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -350,10 +335,10 @@ public:
__iom_t8(const _MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {}
template <class _CharT, class _Traits, class _Mp>
template <class _CharT, class _Traits, class _M>
friend
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_M>& __x);
};
template <class _CharT, class _Traits, class _MoneyT>
@@ -367,10 +352,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
typedef money_put<_CharT, _Op> _Fp;
const _Fp& __mf = use_facet<_Fp>(__os.getloc());
if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
typedef ostreambuf_iterator<_CharT, _Traits> _O;
typedef money_put<_CharT, _O> _F;
const _F& __mf = use_facet<_F>(__os.getloc());
if (__mf.put(_O(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
__os.setstate(ios_base::badbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -409,10 +394,10 @@ public:
__iom_t9(tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {}
template <class _Cp, class _Traits>
template <class _C, class _Traits>
friend
basic_istream<_Cp, _Traits>&
operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
basic_istream<_C, _Traits>&
operator>>(basic_istream<_C, _Traits>& __is, const __iom_t9<_C>& __x);
};
template <class _CharT, class _Traits>
@@ -426,11 +411,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s)
{
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef time_get<_CharT, _Ip> _Fp;
typedef istreambuf_iterator<_CharT, _Traits> _I;
typedef time_get<_CharT, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
const _Fp& __tf = use_facet<_Fp>(__is.getloc());
__tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
const _F& __tf = use_facet<_F>(__is.getloc());
__tf.get(_I(__is), _I(), __is, __err, __x.__tm_,
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
__is.setstate(__err);
}
@@ -470,10 +455,10 @@ public:
__iom_t10(const tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {}
template <class _Cp, class _Traits>
template <class _C, class _Traits>
friend
basic_ostream<_Cp, _Traits>&
operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
basic_ostream<_C, _Traits>&
operator<<(basic_ostream<_C, _Traits>& __os, const __iom_t10<_C>& __x);
};
template <class _CharT, class _Traits>
@@ -487,10 +472,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
typedef time_put<_CharT, _Op> _Fp;
const _Fp& __tf = use_facet<_Fp>(__os.getloc());
if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
typedef ostreambuf_iterator<_CharT, _Traits> _O;
typedef time_put<_CharT, _O> _F;
const _F& __tf = use_facet<_F>(__os.getloc());
if (__tf.put(_O(__os), __os, __os.fill(), __x.__tm_,
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
__os.setstate(ios_base::badbit);
}
@@ -512,142 +497,6 @@ put_time(const tm* __tm, const _CharT* __fmt)
return __iom_t10<_CharT>(__tm, __fmt);
}
#if _LIBCPP_STD_VER > 11
template <class _CharT, class _Traits, class _ForwardIterator>
std::basic_ostream<_CharT, _Traits> &
__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
_ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
{
__os << __delim;
for ( ; __first != __last; ++ __first )
{
if (_Traits::eq (*__first, __escape) || _Traits::eq (*__first, __delim))
__os << __escape;
__os << *__first;
}
__os << __delim;
return __os;
}
template <class _CharT, class _Traits, class _String>
basic_istream<_CharT, _Traits> &
__quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _CharT __delim, _CharT __escape )
{
__string.clear ();
_CharT __c;
__is >> __c;
if ( __is.fail ())
return __is;
if (!_Traits::eq (__c, __delim)) // no delimiter, read the whole string
{
__is.unget ();
__is >> __string;
return __is;
}
__save_flags<_CharT, _Traits> sf(__is);
noskipws (__is);
while (true)
{
__is >> __c;
if ( __is.fail ())
break;
if (_Traits::eq (__c, __escape))
{
__is >> __c;
if ( __is.fail ())
break;
}
else if (_Traits::eq (__c, __delim))
break;
__string.push_back ( __c );
}
return __is;
}
template <class _CharT, class _Iter, class _Traits=char_traits<_CharT>>
struct __quoted_output_proxy
{
_Iter __first;
_Iter __last;
_CharT __delim;
_CharT __escape;
__quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e)
: __first(__f), __last(__l), __delim(__d), __escape(__e) {}
// This would be a nice place for a string_ref
};
template <class _CharT, class _Traits, class _Iter>
basic_ostream<_CharT, _Traits>& operator<<(
basic_ostream<_CharT, _Traits>& __os,
const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy)
{
return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape);
}
template <class _CharT, class _Traits, class _Allocator>
struct __quoted_proxy
{
basic_string<_CharT, _Traits, _Allocator> &__string;
_CharT __delim;
_CharT __escape;
__quoted_proxy(basic_string<_CharT, _Traits, _Allocator> &__s, _CharT __d, _CharT __e)
: __string(__s), __delim(__d), __escape(__e) {}
};
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>& operator<<(
basic_ostream<_CharT, _Traits>& __os,
const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
{
return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape);
}
// extractor for non-const basic_string& proxies
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>& operator>>(
basic_istream<_CharT, _Traits>& __is,
const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
{
return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape );
}
template <class _CharT>
_LIBCPP_INLINE_VISIBILITY
__quoted_output_proxy<_CharT, const _CharT *>
quoted ( const _CharT *__s, _CharT __delim = _CharT('"'), _CharT __escape =_CharT('\\'))
{
const _CharT *__end = __s;
while ( *__end ) ++__end;
return __quoted_output_proxy<_CharT, const _CharT *> ( __s, __end, __delim, __escape );
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY
__quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
quoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
{
return __quoted_output_proxy<_CharT,
typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
( __s.cbegin(), __s.cend (), __delim, __escape );
}
template <class _CharT, class _Traits, class _Allocator>
__quoted_proxy<_CharT, _Traits, _Allocator>
quoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
{
return __quoted_proxy<_CharT, _Traits, _Allocator>( __s, __delim, __escape );
}
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_IOMANIP

View File

@@ -29,43 +29,43 @@ public:
class failure;
typedef T1 fmtflags;
static constexpr fmtflags boolalpha;
static constexpr fmtflags dec;
static constexpr fmtflags fixed;
static constexpr fmtflags hex;
static constexpr fmtflags internal;
static constexpr fmtflags left;
static constexpr fmtflags oct;
static constexpr fmtflags right;
static constexpr fmtflags scientific;
static constexpr fmtflags showbase;
static constexpr fmtflags showpoint;
static constexpr fmtflags showpos;
static constexpr fmtflags skipws;
static constexpr fmtflags unitbuf;
static constexpr fmtflags uppercase;
static constexpr fmtflags adjustfield;
static constexpr fmtflags basefield;
static constexpr fmtflags floatfield;
static const fmtflags boolalpha;
static const fmtflags dec;
static const fmtflags fixed;
static const fmtflags hex;
static const fmtflags internal;
static const fmtflags left;
static const fmtflags oct;
static const fmtflags right;
static const fmtflags scientific;
static const fmtflags showbase;
static const fmtflags showpoint;
static const fmtflags showpos;
static const fmtflags skipws;
static const fmtflags unitbuf;
static const fmtflags uppercase;
static const fmtflags adjustfield;
static const fmtflags basefield;
static const fmtflags floatfield;
typedef T2 iostate;
static constexpr iostate badbit;
static constexpr iostate eofbit;
static constexpr iostate failbit;
static constexpr iostate goodbit;
static const iostate badbit;
static const iostate eofbit;
static const iostate failbit;
static const iostate goodbit;
typedef T3 openmode;
static constexpr openmode app;
static constexpr openmode ate;
static constexpr openmode binary;
static constexpr openmode in;
static constexpr openmode out;
static constexpr openmode trunc;
static const openmode app;
static const openmode ate;
static const openmode binary;
static const openmode in;
static const openmode out;
static const openmode trunc;
typedef T4 seekdir;
static constexpr seekdir beg;
static constexpr seekdir cur;
static constexpr seekdir end;
static const seekdir beg;
static const seekdir cur;
static const seekdir end;
class Init;
@@ -160,7 +160,7 @@ protected:
basic_ios();
void init(basic_streambuf<charT,traits>* sb);
void move(basic_ios& rhs);
void swap(basic_ios& rhs) noexcept;
void swap(basic_ios& rhs);
void set_rdbuf(basic_streambuf<charT, traits>* sb);
};
@@ -203,9 +203,9 @@ enum class io_errc
};
concept_map ErrorCodeEnum<io_errc> { };
error_code make_error_code(io_errc e) noexcept;
error_condition make_error_condition(io_errc e) noexcept;
storage-class-specifier const error_category& iostream_category() noexcept;
error_code make_error_code(io_errc e);
error_condition make_error_condition(io_errc e);
storage-class-specifier const error_category& iostream_category;
} // std
@@ -216,22 +216,16 @@ storage-class-specifier const error_category& iostream_category() noexcept;
#include <__locale>
#include <system_error>
#if __has_feature(cxx_atomic)
#include <atomic> // for __xindex_
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
typedef ptrdiff_t streamsize;
class _LIBCPP_TYPE_VIS ios_base
class _LIBCPP_VISIBLE ios_base
{
public:
class _LIBCPP_TYPE_VIS failure;
class failure;
typedef unsigned int fmtflags;
static const fmtflags boolalpha = 0x0001;
@@ -275,7 +269,7 @@ public:
typedef _VSTD::streamoff streamoff;
typedef _VSTD::streampos streampos;
class _LIBCPP_TYPE_VIS Init;
class Init;
// 27.5.2.2 fmtflags state:
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
@@ -323,7 +317,7 @@ public:
_LIBCPP_INLINE_VISIBILITY bool bad() const;
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __iostate);
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except);
void __set_badbit_and_consider_rethrow();
void __set_failbit_and_consider_rethrow();
@@ -346,7 +340,7 @@ protected:
void __call_callbacks(event);
void copyfmt(const ios_base&);
void move(ios_base&);
void swap(ios_base&) _NOEXCEPT;
void swap(ios_base&);
_LIBCPP_ALWAYS_INLINE
void set_rdbuf(void* __sb)
@@ -367,11 +361,7 @@ private:
int* __index_;
size_t __event_size_;
size_t __event_cap_;
#if __has_feature(cxx_atomic)
static atomic<int> __xindex_;
#else
static int __xindex_;
#endif
long* __iarray_;
size_t __iarray_size_;
size_t __iarray_cap_;
@@ -381,33 +371,35 @@ private:
};
//enum class io_errc
_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
struct _LIBCPP_VISIBLE io_errc
{
enum _ {
stream = 1
};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
_ __v_;
_LIBCPP_ALWAYS_INLINE io_errc(_ __v) : __v_(__v) {}
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
};
template <>
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc> : public true_type { };
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
template <>
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc::__lx> : public true_type { };
#endif
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
_LIBCPP_FUNC_VIS
const error_category& iostream_category() _NOEXCEPT;
_LIBCPP_VISIBLE
const error_category& iostream_category();
inline _LIBCPP_INLINE_VISIBILITY
error_code
make_error_code(io_errc __e) _NOEXCEPT
make_error_code(io_errc __e)
{
return error_code(static_cast<int>(__e), iostream_category());
}
inline _LIBCPP_INLINE_VISIBILITY
error_condition
make_error_condition(io_errc __e) _NOEXCEPT
make_error_condition(io_errc __e)
{
return error_condition(static_cast<int>(__e), iostream_category());
}
@@ -421,7 +413,7 @@ public:
virtual ~failure() throw();
};
class _LIBCPP_TYPE_VIS ios_base::Init
class _LIBCPP_VISIBLE ios_base::Init
{
public:
Init();
@@ -535,21 +527,21 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
ios_base::eof() const
{
return (__rdstate_ & eofbit) != 0;
return __rdstate_ & eofbit;
}
inline _LIBCPP_INLINE_VISIBILITY
bool
ios_base::fail() const
{
return (__rdstate_ & (failbit | badbit)) != 0;
return __rdstate_ & (failbit | badbit);
}
inline _LIBCPP_INLINE_VISIBILITY
bool
ios_base::bad() const
{
return (__rdstate_ & badbit) != 0;
return __rdstate_ & badbit;
}
inline _LIBCPP_INLINE_VISIBILITY
@@ -561,14 +553,14 @@ ios_base::exceptions() const
inline _LIBCPP_INLINE_VISIBILITY
void
ios_base::exceptions(iostate __iostate)
ios_base::exceptions(iostate __except)
{
__exceptions_ = __iostate;
__exceptions_ = __except;
clear(__rdstate_);
}
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_ios
class _LIBCPP_VISIBLE basic_ios
: public ios_base
{
public:
@@ -580,8 +572,7 @@ public:
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
_LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT
_LIBCPP_ALWAYS_INLINE // explicit
operator bool() const {return !fail();}
_LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
_LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
@@ -593,7 +584,7 @@ public:
_LIBCPP_ALWAYS_INLINE bool bad() const {return ios_base::bad();}
_LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
// 27.5.4.1 Constructor/destructor:
_LIBCPP_INLINE_VISIBILITY
@@ -640,12 +631,12 @@ protected:
void move(basic_ios&& __rhs) {move(__rhs);}
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(basic_ios& __rhs) _NOEXCEPT;
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_;
mutable int_type __fill_;
char_type __fill_;
};
template <class _CharT, class _Traits>
@@ -667,7 +658,7 @@ basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
{
ios_base::init(__sb);
__tie_ = 0;
__fill_ = traits_type::eof();
__fill_ = widen(' ');
}
template <class _CharT, class _Traits>
@@ -739,8 +730,6 @@ inline _LIBCPP_INLINE_VISIBILITY
_CharT
basic_ios<_CharT, _Traits>::fill() const
{
if (traits_type::eq_int_type(traits_type::eof(), __fill_))
__fill_ = widen(' ');
return __fill_;
}
@@ -784,7 +773,7 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
void
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
{
ios_base::swap(__rhs);
_VSTD::swap(__tie_, __rhs.__tie_);
@@ -991,33 +980,6 @@ defaultfloat(ios_base& __str)
return __str;
}
template <class _CharT, class _Traits>
class __save_flags
{
typedef basic_ios<_CharT, _Traits> __stream_type;
typedef typename __stream_type::fmtflags fmtflags;
__stream_type& __stream_;
fmtflags __fmtflags_;
_CharT __fill_;
__save_flags(const __save_flags&);
__save_flags& operator=(const __save_flags&);
public:
_LIBCPP_INLINE_VISIBILITY
explicit __save_flags(__stream_type& __stream)
: __stream_(__stream),
__fmtflags_(__stream.flags()),
__fill_(__stream.fill())
{}
_LIBCPP_INLINE_VISIBILITY
~__save_flags()
{
__stream_.flags(__fmtflags_);
__stream_.fill(__fill_);
}
};
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_IOS

View File

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

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

View File

@@ -155,16 +155,12 @@ template <class charT, class traits, class T>
#include <__config>
#include <ostream>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_istream
class _LIBCPP_VISIBLE basic_istream
: virtual public basic_ios<_CharT, _Traits>
{
streamsize __gc_;
@@ -194,7 +190,7 @@ protected:
public:
// 27.7.1.1.3 Prefix/suffix:
class _LIBCPP_TYPE_VIS_ONLY sentry;
class sentry;
// 27.7.1.2 Formatted input:
basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
@@ -244,7 +240,7 @@ public:
};
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_istream<_CharT, _Traits>::sentry
class _LIBCPP_VISIBLE basic_istream<_CharT, _Traits>::sentry
{
bool __ok_;
@@ -256,7 +252,7 @@ public:
// ~sentry() = default;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_EXPLICIT
// explicit
operator bool() const {return __ok_;}
};
@@ -271,10 +267,10 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
__is.tie()->flush();
if (!__noskipws && (__is.flags() & ios_base::skipws))
{
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef istreambuf_iterator<_CharT, _Traits> _I;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
_Ip __i(__is);
_Ip __eof;
_I __i(__is);
_I __eof;
for (; __i != __eof; ++__i)
if (!__ct.is(__ct.space, *__i))
break;
@@ -342,10 +338,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -369,10 +365,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -396,10 +392,10 @@ basic_istream<_CharT, _Traits>::operator>>(long& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -423,10 +419,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -450,10 +446,10 @@ basic_istream<_CharT, _Traits>::operator>>(long long& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -477,10 +473,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -504,10 +500,10 @@ basic_istream<_CharT, _Traits>::operator>>(float& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -531,10 +527,10 @@ basic_istream<_CharT, _Traits>::operator>>(double& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -558,10 +554,10 @@ basic_istream<_CharT, _Traits>::operator>>(long double& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -585,10 +581,10 @@ basic_istream<_CharT, _Traits>::operator>>(bool& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -612,10 +608,10 @@ basic_istream<_CharT, _Traits>::operator>>(void*& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -639,11 +635,11 @@ basic_istream<_CharT, _Traits>::operator>>(short& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
long __temp;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
if (__temp < numeric_limits<short>::min())
{
__err |= ios_base::failbit;
@@ -679,11 +675,11 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
sentry __s(*this);
if (__s)
{
typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _Ip> _Fp;
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit;
long __temp;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
if (__temp < numeric_limits<int>::min())
{
__err |= ios_base::failbit;
@@ -746,29 +742,26 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen)
{
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __n = __is.width();
if (__n <= 0)
if (__n == 0)
__n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
streamsize __c = 0;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
ios_base::iostate __err = ios_base::goodbit;
while (__c < __n-1)
_I __i(__is);
_I __eof;
for (; __i != __eof && __c < __n-1; ++__i, ++__s, ++__c)
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
_CharT __ch = *__i;
if (__ct.is(__ct.space, __ch))
break;
*__s++ = __ch;
++__c;
__is.rdbuf()->sbumpc();
*__s = __ch;
}
*__s = _CharT();
__is.width(0);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
__is.setstate(__err);
@@ -810,11 +803,25 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
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;
if (__i != __eof)
{
__c = *__i;
if (++__i == __eof)
__is.setstate(ios_base::eofbit);
}
else
__is.setstate(ios_base::eofbit | ios_base::failbit);
#endif
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -854,42 +861,42 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
sentry __s(*this, true);
if (__s)
{
streamsize __c = 0;
if (__sb)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
ios_base::iostate __err = ios_base::goodbit;
while (true)
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef ostreambuf_iterator<char_type, traits_type> _O;
_I __i(*this);
_I __eof;
_O __o(__sb);
for (; __i != __eof; ++__i, ++__o, ++__c)
{
typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
if (traits_type::eq_int_type(
__sb->sputc(traits_type::to_char_type(__i)),
traits_type::eof()))
*__o = *__i;
if (__o.failed())
break;
++__gc_;
this->rdbuf()->sbumpc();
}
if (__gc_ == 0)
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
this->setstate(__err);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
if (__gc_ == 0)
if (__c == 0)
this->__set_failbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
else
this->setstate(ios_base::failbit);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -914,11 +921,22 @@ basic_istream<_CharT, _Traits>::get()
sentry __s(*this, true);
if (__s)
{
__r = this->rdbuf()->sbumpc();
if (traits_type::eq_int_type(__r, traits_type::eof()))
this->setstate(ios_base::failbit | ios_base::eofbit);
streamsize __c = 0;
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
ios_base::iostate __err = ios_base::goodbit;
if (__i != __eof)
{
__r = traits_type::to_int_type(*__i);
++__c;
if (++__i == __eof)
__err |= ios_base::eofbit;
}
else
__gc_ = 1;
__err |= ios_base::failbit | ios_base::eofbit;
this->setstate(__err);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -953,31 +971,30 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
sentry __sen(*this, true);
if (__sen)
{
streamsize __c = 0;
if (__n > 0)
{
ios_base::iostate __err = ios_base::goodbit;
while (__gc_ < __n-1)
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
for (; __i != __eof && __n > 1; ++__i, ++__s, ++__c)
{
int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
char_type __ch = *__i;
if (traits_type::eq(__ch, __dlm))
break;
*__s++ = __ch;
++__gc_;
this->rdbuf()->sbumpc();
*__s = __ch;
}
*__s = char_type();
if (__gc_ == 0)
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
this->setstate(__err);
}
else
this->setstate(ios_base::failbit);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1010,36 +1027,38 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
sentry __sen(*this, true);
if (__sen)
{
streamsize __c = 0;
ios_base::iostate __err = ios_base::goodbit;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
while (true)
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef ostreambuf_iterator<char_type, traits_type> _O;
_I __i(*this);
_I __eof;
_O __o(&__sb);
for (; __i != __eof; ++__i, ++__o, ++__c)
{
typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
char_type __ch = *__i;
if (traits_type::eq(__ch, __dlm))
break;
if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
*__o = __ch;
if (__o.failed())
break;
++__gc_;
this->rdbuf()->sbumpc();
}
if (__i == __eof)
__err |= ios_base::eofbit;
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
if (__gc_ == 0)
if (__c == 0)
__err |= ios_base::failbit;
this->setstate(__err);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1071,36 +1090,33 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
sentry __sen(*this, true);
if (__sen)
{
ios_base::iostate __err = ios_base::goodbit;
while (true)
streamsize __c = 0;
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
for (; __i != __eof; ++__s, --__n)
{
typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
char_type __ch = *__i;
++__i;
++__c;
if (traits_type::eq(__ch, __dlm))
break;
if (__n < 2)
{
this->rdbuf()->sbumpc();
++__gc_;
this->setstate(ios_base::failbit);
break;
}
if (__gc_ >= __n-1)
{
__err |= ios_base::failbit;
break;
}
*__s++ = __ch;
this->rdbuf()->sbumpc();
++__gc_;
*__s = __ch;
}
if (__n > 0)
if (__n)
*__s = char_type();
if (__gc_ == 0)
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
this->setstate(__err);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1132,38 +1148,35 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
sentry __sen(*this, true);
if (__sen)
{
ios_base::iostate __err = ios_base::goodbit;
if (__n == numeric_limits<streamsize>::max())
streamsize __c = 0;
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
if (__n != numeric_limits<streamsize>::max())
{
while (true)
for (; __n > 0 && __i != __eof; --__n)
{
typename traits_type::int_type __i = this->rdbuf()->sbumpc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
++__gc_;
if (traits_type::eq_int_type(__i, __dlm))
char_type __ch = *__i;
++__i;
++__c;
if (traits_type::eq(__ch, __dlm))
break;
}
}
else
{
while (__gc_ < __n)
while (__i != __eof)
{
typename traits_type::int_type __i = this->rdbuf()->sbumpc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
++__gc_;
if (traits_type::eq_int_type(__i, __dlm))
char_type __ch = *__i;
++__i;
++__c;
if (traits_type::eq(__ch, __dlm))
break;
}
}
this->setstate(__err);
if (__i == __eof)
this->setstate(ios_base::eofbit);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1187,11 +1200,7 @@ basic_istream<_CharT, _Traits>::peek()
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this, true);
if (__sen)
{
__r = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__r, traits_type::eof()))
this->setstate(ios_base::eofbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -1214,9 +1223,20 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
sentry __sen(*this, true);
if (__sen)
{
__gc_ = this->rdbuf()->sgetn(__s, __n);
if (__gc_ != __n)
this->setstate(ios_base::failbit | ios_base::eofbit);
streamsize __c = 0;
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
for (; __i != __eof && __n > 0; ++__i, ++__s, ++__c, --__n)
*__s = *__i;
if (__i == __eof)
{
ios_base::iostate __err = ios_base::eofbit;
if (__n > 0)
__err |= ios_base::failbit;
this->setstate(__err);
}
__gc_ = __c;
}
else
this->setstate(ios_base::failbit);
@@ -1235,19 +1255,44 @@ streamsize
basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
{
__gc_ = 0;
streamsize __c = this->rdbuf()->in_avail();
switch (__c)
streamsize __c = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
case -1:
this->setstate(ios_base::eofbit);
break;
case 0:
break;
default:
read(__s, _VSTD::min(__c, __n));
break;
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this, true);
if (__sen)
{
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
__c = this->rdbuf()->in_avail();
switch (__c)
{
case -1:
__i = __eof;
break;
case 0:
break;
default:
__c = _VSTD::min(__c, __n);
for (streamsize __k = 0; __k < __c; ++__k, ++__s, ++__i)
*__s = *__i;
}
if (__i == __eof)
this->setstate(ios_base::eofbit);
__gc_ = __c;
}
else
this->setstate(ios_base::failbit);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
return __gc_;
catch (...)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
return __c;
}
template<class _CharT, class _Traits>
@@ -1259,7 +1304,6 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true);
if (__sen)
{
@@ -1287,7 +1331,6 @@ basic_istream<_CharT, _Traits>::unget()
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true);
if (__sen)
{
@@ -1366,13 +1409,10 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true);
if (__sen)
{
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
this->setstate(ios_base::failbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -1393,10 +1433,7 @@ basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this, true);
if (__sen)
{
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
this->setstate(ios_base::failbit);
}
this->rdbuf()->pubseekoff(__off, __dir, ios_base::in);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -1418,19 +1455,15 @@ ws(basic_istream<_CharT, _Traits>& __is)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
if (__sen)
{
typedef istreambuf_iterator<_CharT, _Traits> _I;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
while (true)
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__is.setstate(ios_base::eofbit);
break;
}
if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
_I __i(__is);
_I __eof;
for (; __i != __eof; ++__i)
if (!__ct.is(__ct.space, *__i))
break;
__is.rdbuf()->sbumpc();
}
if (__i == __eof)
__is.setstate(ios_base::failbit | ios_base::eofbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1456,7 +1489,7 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_iostream
class _LIBCPP_VISIBLE basic_iostream
: public basic_istream<_CharT, _Traits>,
public basic_ostream<_CharT, _Traits>
{
@@ -1539,30 +1572,27 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
if (__sen)
{
__str.clear();
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __n = __is.width();
if (__n <= 0)
if (__n == 0)
__n = __str.max_size();
if (__n <= 0)
if (__n < 0)
__n = numeric_limits<streamsize>::max();
streamsize __c = 0;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
ios_base::iostate __err = ios_base::goodbit;
while (__c < __n)
_I __i(__is);
_I __eof;
for (; __i != __eof && __c < __n; ++__i, ++__c)
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
_CharT __ch = *__i;
if (__ct.is(__ct.space, __ch))
break;
__str.push_back(__ch);
++__c;
__is.rdbuf()->sbumpc();
}
__is.width(0);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
__is.setstate(__err);
@@ -1592,28 +1622,31 @@ getline(basic_istream<_CharT, _Traits>& __is,
if (__sen)
{
__str.clear();
ios_base::iostate __err = ios_base::goodbit;
streamsize __extr = 0;
while (true)
streamsize __c = 0;
typedef istreambuf_iterator<_CharT, _Traits> _I;
_I __i(__is);
_I __eof;
streamsize __n = __str.max_size();
if (__n < 0)
__n = numeric_limits<streamsize>::max();
for (; __i != __eof;)
{
typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
++__extr;
_CharT __ch = _Traits::to_char_type(__i);
_CharT __ch = *__i;
++__i;
++__c;
if (_Traits::eq(__ch, __dlm))
break;
__str.push_back(__ch);
if (__str.size() == __str.max_size())
if (__c == __n)
{
__err |= ios_base::failbit;
__is.setstate(ios_base::failbit);
break;
}
__str.push_back(__ch);
}
if (__extr == 0)
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
__is.setstate(__err);
}
@@ -1671,26 +1704,24 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
{
basic_string<_CharT, _Traits> __str;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __c = 0;
ios_base::iostate __err = ios_base::goodbit;
_CharT __zero = __ct.widen('0');
_CharT __one = __ct.widen('1');
while (__c < _Size)
_I __i(__is);
_I __eof;
for (; __i != __eof && __c < _Size; ++__i, ++__c)
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
_CharT __ch = *__i;
if (__ch != __zero && __ch != __one)
break;
__str.push_back(__ch);
++__c;
__is.rdbuf()->sbumpc();
}
__is.width(0);
__x = bitset<_Size>(__str);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
__is.setstate(__err);
@@ -1707,9 +1738,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
return __is;
}
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_istream<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_istream<wchar_t>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_iostream<char>)
extern template class basic_istream<char>;
extern template class basic_istream<wchar_t>;
extern template class basic_iostream<char>;
_LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -27,18 +27,6 @@ public:
virtual const char* what() const noexcept;
};
class bad_array_length : public bad_alloc // C++14
{
public:
bad_array_length() noexcept;
};
class bad_array_new_length : public bad_alloc
{
public:
bad_array_new_length() noexcept;
};
struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
@@ -68,9 +56,7 @@ void operator delete[](void* ptr, void*) noexcept;
#include <exception>
#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace
{
@@ -93,58 +79,37 @@ public:
virtual const char* what() const _NOEXCEPT;
};
#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
void __throw_bad_alloc(); // not in C++ spec
class _LIBCPP_EXCEPTION_ABI bad_array_length
: public bad_alloc
{
public:
bad_array_length() _NOEXCEPT;
virtual ~bad_array_length() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
#define _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
#endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
_LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
struct _LIBCPP_TYPE_VIS nothrow_t {};
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
struct _LIBCPP_VISIBLE nothrow_t {};
extern _LIBCPP_VISIBLE const nothrow_t nothrow;
typedef void (*new_handler)();
_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) _NOEXCEPT;
_LIBCPP_VISIBLE new_handler get_new_handler() _NOEXCEPT;
} // std
#if defined(_WIN32) && !defined(cxx_EXPORTS)
# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS_ONLY
#else
# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS
#endif
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz)
_LIBCPP_VISIBLE void* operator new(std::size_t __sz)
#if !__has_feature(cxx_noexcept)
throw(std::bad_alloc)
#endif
;
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz)
#if !__has_feature(cxx_noexcept)
throw(std::bad_alloc)
#endif
;
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) _NOEXCEPT {}
#endif // _LIBCPP_NEW

View File

@@ -60,9 +60,7 @@ template <class ForwardIterator, class T>
#include <__config>
#include <iterator>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -157,7 +155,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
{
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
*__result = __t2 - __t1;
__t1 = _VSTD::move(__t2);
__t1 = __t2;
}
}
return __result;
@@ -177,7 +175,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
{
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
*__result = __binary_op(__t2, __t1);
__t1 = _VSTD::move(__t2);
__t1 = __t2;
}
}
return __result;
@@ -186,10 +184,10 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
template <class _ForwardIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
{
for (; __first != __last; ++__first, ++__value_)
*__first = __value_;
for (; __first != __last; ++__first, ++__value)
*__first = __value;
}
_LIBCPP_END_NAMESPACE_STD

View File

@@ -32,7 +32,6 @@ public:
virtual ~basic_ostream();
// 27.7.2.3 Assign/swap
basic_ostream& operator=(const basic_ostream& rhs) = delete; // C++14
basic_ostream& operator=(basic_ostream&& rhs);
void swap(basic_ostream& rhs);
@@ -134,14 +133,12 @@ template <class charT, class traits, class T>
#include <iterator>
#include <bitset>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_ostream
class _LIBCPP_VISIBLE basic_ostream
: virtual public basic_ios<_CharT, _Traits>
{
public:
@@ -162,9 +159,6 @@ protected:
#endif
// 27.7.2.3 Assign/swap
#if _LIBCPP_STD_VER > 11
basic_ostream& operator=(const basic_ostream&) = delete;
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_ostream& operator=(basic_ostream&& __rhs);
@@ -173,7 +167,7 @@ protected:
public:
// 27.7.2.4 Prefix/suffix:
class _LIBCPP_TYPE_VIS_ONLY sentry;
class sentry;
// 27.7.2.6 Formatted output:
basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
@@ -211,7 +205,7 @@ protected:
};
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_ostream<_CharT, _Traits>::sentry
class _LIBCPP_VISIBLE basic_ostream<_CharT, _Traits>::sentry
{
bool __ok_;
basic_ostream<_CharT, _Traits>& __os_;
@@ -224,7 +218,7 @@ public:
~sentry();
_LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT
// explicit
operator bool() const {return __ok_;}
};
@@ -346,11 +340,11 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
_Ip __i(__sb);
_Ip __eof;
_Op __o(*this);
typedef istreambuf_iterator<_CharT, _Traits> _I;
typedef ostreambuf_iterator<_CharT, _Traits> _O;
_I __i(__sb);
_I __eof;
_O __o(*this);
size_t __c = 0;
for (; __i != __eof; ++__i, ++__o, ++__c)
{
@@ -392,8 +386,8 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -419,8 +413,8 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
if (__s)
{
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned short>(__n)) :
@@ -448,8 +442,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -475,8 +469,8 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
if (__s)
{
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned int>(__n)) :
@@ -504,8 +498,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -530,8 +524,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -556,8 +550,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -582,8 +576,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -608,8 +602,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -634,8 +628,8 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -660,8 +654,8 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -686,8 +680,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -712,8 +706,8 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
sentry __s(*this);
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _Fp& __f = use_facet<_Fp>(this->getloc());
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -738,8 +732,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
if (__pad_and_output(_Ip(__os),
typedef ostreambuf_iterator<_CharT, _Traits> _I;
if (__pad_and_output(_I(__os),
&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 :
@@ -771,8 +765,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
if (__s)
{
_CharT __c = __os.widen(__cn);
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
if (__pad_and_output(_Ip(__os),
typedef ostreambuf_iterator<_CharT, _Traits> _I;
if (__pad_and_output(_I(__os),
&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 :
@@ -803,8 +797,8 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<char, _Traits> _Ip;
if (__pad_and_output(_Ip(__os),
typedef ostreambuf_iterator<char, _Traits> _I;
if (__pad_and_output(_I(__os),
&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 :
@@ -835,8 +829,8 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<char, _Traits> _Ip;
if (__pad_and_output(_Ip(__os),
typedef ostreambuf_iterator<char, _Traits> _I;
if (__pad_and_output(_I(__os),
(char*)&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
(char*)&__c + 1 :
@@ -867,8 +861,8 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<char, _Traits> _Ip;
if (__pad_and_output(_Ip(__os),
typedef ostreambuf_iterator<char, _Traits> _I;
if (__pad_and_output(_I(__os),
(char*)&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
(char*)&__c + 1 :
@@ -899,9 +893,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
typedef ostreambuf_iterator<_CharT, _Traits> _I;
size_t __len = _Traits::length(__str);
if (__pad_and_output(_Ip(__os),
if (__pad_and_output(_I(__os),
__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str + __len :
@@ -932,7 +926,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
typedef ostreambuf_iterator<_CharT, _Traits> _I;
size_t __len = char_traits<char>::length(__strn);
const int __bs = 100;
_CharT __wbb[__bs];
@@ -947,7 +941,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
}
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
*__p = __os.widen(*__strn);
if (__pad_and_output(_Ip(__os),
if (__pad_and_output(_I(__os),
__wb,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
__wb + __len :
@@ -978,9 +972,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<char, _Traits> _Ip;
typedef ostreambuf_iterator<char, _Traits> _I;
size_t __len = _Traits::length(__str);
if (__pad_and_output(_Ip(__os),
if (__pad_and_output(_I(__os),
__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str + __len :
@@ -1011,9 +1005,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<char, _Traits> _Ip;
typedef ostreambuf_iterator<char, _Traits> _I;
size_t __len = _Traits::length((const char*)__str);
if (__pad_and_output(_Ip(__os),
if (__pad_and_output(_I(__os),
(const char*)__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
(const char*)__str + __len :
@@ -1044,9 +1038,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<char, _Traits> _Ip;
typedef ostreambuf_iterator<char, _Traits> _I;
size_t __len = _Traits::length((const char*)__str);
if (__pad_and_output(_Ip(__os),
if (__pad_and_output(_I(__os),
(const char*)__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
(const char*)__str + __len :
@@ -1077,8 +1071,8 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
sentry __s(*this);
if (__s)
{
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
_Op __o(*this);
typedef ostreambuf_iterator<_CharT, _Traits> _O;
_O __o(*this);
*__o = __c;
if (__o.failed())
this->setstate(ios_base::badbit);
@@ -1104,8 +1098,17 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
sentry __sen(*this);
if (__sen && __n)
{
if (this->rdbuf()->sputn(__s, __n) != __n)
this->setstate(ios_base::badbit);
typedef ostreambuf_iterator<_CharT, _Traits> _O;
_O __o(*this);
for (; __n; --__n, ++__o, ++__s)
{
*__o = *__s;
if (__o.failed())
{
this->setstate(ios_base::badbit);
break;
}
}
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1159,8 +1162,7 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
{
sentry __s(*this);
if (__s)
if (!this->fail())
{
if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
this->setstate(ios_base::failbit);
@@ -1173,12 +1175,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
{
sentry __s(*this);
if (__s)
{
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
this->setstate(ios_base::failbit);
}
if (!this->fail())
this->rdbuf()->pubseekoff(__off, __dir, ios_base::out);
return *this;
}
@@ -1218,12 +1216,12 @@ typename enable_if
<
!is_lvalue_reference<_Stream>::value &&
is_base_of<ios_base, _Stream>::value,
_Stream&&
_Stream&
>::type
operator<<(_Stream&& __os, const _Tp& __x)
{
__os << __x;
return _VSTD::move(__os);
return __os;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1240,9 +1238,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
typedef ostreambuf_iterator<_CharT, _Traits> _I;
size_t __len = __str.size();
if (__pad_and_output(_Ip(__os),
if (__pad_and_output(_I(__os),
__str.data(),
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str.data() + __len :
@@ -1270,10 +1268,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
return __os << __ec.category().name() << ':' << __ec.value();
}
template<class _CharT, class _Traits, class _Yp>
template<class _CharT, class _Traits, class _Y>
inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
{
return __os << __p.get();
}
@@ -1287,8 +1285,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
}
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<wchar_t>)
extern template class basic_ostream<char>;
extern template class basic_ostream<wchar_t>;
_LIBCPP_END_NAMESPACE_STD

View File

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

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

View File

@@ -147,7 +147,7 @@ public:
explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
basic_regex(const charT* p, size_t len, flag_type f);
basic_regex(const basic_regex&);
basic_regex(basic_regex&&) noexcept;
basic_regex(basic_regex&&);
template <class ST, class SA>
explicit basic_regex(const basic_string<charT, ST, SA>& p,
flag_type f = regex_constants::ECMAScript);
@@ -159,7 +159,7 @@ public:
~basic_regex();
basic_regex& operator=(const basic_regex&);
basic_regex& operator=(basic_regex&&) noexcept;
basic_regex& operator=(basic_regex&&);
basic_regex& operator=(const charT* ptr);
basic_regex& operator=(initializer_list<charT> il);
template <class ST, class SA>
@@ -167,7 +167,7 @@ public:
// assign:
basic_regex& assign(const basic_regex& that);
basic_regex& assign(basic_regex&& that) noexcept;
basic_regex& assign(basic_regex&& that);
basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
basic_regex& assign(const charT* p, size_t len, flag_type f);
template <class string_traits, class A>
@@ -449,7 +449,7 @@ public:
// construct/copy/destroy:
explicit match_results(const Allocator& a = Allocator());
match_results(const match_results& m);
match_results(match_results&& m) noexcept;
match_results(match_results&& m);
match_results& operator=(const match_results& m);
match_results& operator=(match_results&& m);
~match_results();
@@ -732,11 +732,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#include <vector>
#include <deque>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -760,15 +756,15 @@ enum syntax_option_type
};
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
/*constexpr*/
syntax_option_type
operator~(syntax_option_type __x)
{
return syntax_option_type(~int(__x) & 0x1FF);
return syntax_option_type(~int(__x));
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
/*constexpr*/
syntax_option_type
operator&(syntax_option_type __x, syntax_option_type __y)
{
@@ -776,7 +772,7 @@ operator&(syntax_option_type __x, syntax_option_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
/*constexpr*/
syntax_option_type
operator|(syntax_option_type __x, syntax_option_type __y)
{
@@ -784,7 +780,7 @@ operator|(syntax_option_type __x, syntax_option_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
/*constexpr*/
syntax_option_type
operator^(syntax_option_type __x, syntax_option_type __y)
{
@@ -792,6 +788,7 @@ operator^(syntax_option_type __x, syntax_option_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
syntax_option_type&
operator&=(syntax_option_type& __x, syntax_option_type __y)
{
@@ -800,6 +797,7 @@ operator&=(syntax_option_type& __x, syntax_option_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
syntax_option_type&
operator|=(syntax_option_type& __x, syntax_option_type __y)
{
@@ -808,6 +806,7 @@ operator|=(syntax_option_type& __x, syntax_option_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
syntax_option_type&
operator^=(syntax_option_type& __x, syntax_option_type __y)
{
@@ -836,15 +835,15 @@ enum match_flag_type
};
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
/*constexpr*/
match_flag_type
operator~(match_flag_type __x)
{
return match_flag_type(~int(__x) & 0x0FFF);
return match_flag_type(~int(__x));
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
/*constexpr*/
match_flag_type
operator&(match_flag_type __x, match_flag_type __y)
{
@@ -852,7 +851,7 @@ operator&(match_flag_type __x, match_flag_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
/*constexpr*/
match_flag_type
operator|(match_flag_type __x, match_flag_type __y)
{
@@ -860,7 +859,7 @@ operator|(match_flag_type __x, match_flag_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
/*constexpr*/
match_flag_type
operator^(match_flag_type __x, match_flag_type __y)
{
@@ -868,6 +867,7 @@ operator^(match_flag_type __x, match_flag_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
match_flag_type&
operator&=(match_flag_type& __x, match_flag_type __y)
{
@@ -876,6 +876,7 @@ operator&=(match_flag_type& __x, match_flag_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
match_flag_type&
operator|=(match_flag_type& __x, match_flag_type __y)
{
@@ -884,6 +885,7 @@ operator|=(match_flag_type& __x, match_flag_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
match_flag_type&
operator^=(match_flag_type& __x, match_flag_type __y)
{
@@ -925,7 +927,7 @@ public:
};
template <class _CharT>
struct _LIBCPP_TYPE_VIS_ONLY regex_traits
struct _LIBCPP_VISIBLE regex_traits
{
public:
typedef _CharT char_type;
@@ -970,7 +972,7 @@ public:
bool isctype(char_type __c, char_class_type __m) const;
_LIBCPP_INLINE_VISIBILITY
int value(char_type __ch, int __radix) const
{return __regex_traits_value(__ch, __radix);}
{return __value(__ch, __radix);}
locale_type imbue(locale_type __l);
_LIBCPP_INLINE_VISIBILITY
locale_type getloc()const {return __loc_;}
@@ -1001,17 +1003,13 @@ private:
__lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
bool __icase, wchar_t) const;
static int __regex_traits_value(unsigned char __ch, int __radix);
static int __value(unsigned char __ch, int __radix);
_LIBCPP_INLINE_VISIBILITY
int __regex_traits_value(char __ch, int __radix) const
{return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
int __regex_traits_value(wchar_t __ch, int __radix) const;
int __value(char __ch, int __radix) const
{return __value(static_cast<unsigned char>(__ch), __radix);}
int __value(wchar_t __ch, int __radix) const;
};
template <class _CharT>
const typename regex_traits<_CharT>::char_class_type
regex_traits<_CharT>::__regex_word;
template <class _CharT>
regex_traits<_CharT>::regex_traits()
{
@@ -1100,7 +1098,7 @@ regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
// lookup_collatename is very FreeBSD-specific
_LIBCPP_FUNC_VIS string __get_collation_name(const char* __s);
string __get_collation_name(const char* __s);
template <class _CharT>
template <class _ForwardIterator>
@@ -1161,7 +1159,7 @@ regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
// lookup_classname
ctype_base::mask _LIBCPP_FUNC_VIS __get_classname(const char* __s, bool __icase);
ctype_base::mask __get_classname(const char* __s, bool __icase);
template <class _CharT>
template <class _ForwardIterator>
@@ -1207,7 +1205,7 @@ regex_traits<_CharT>::isctype(char_type __c, char_class_type __m) const
template <class _CharT>
int
regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
regex_traits<_CharT>::__value(unsigned char __ch, int __radix)
{
if ((__ch & 0xF8u) == 0x30) // '0' <= __ch && __ch <= '7'
return __ch - '0';
@@ -1228,18 +1226,18 @@ regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
int
regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
regex_traits<_CharT>::__value(wchar_t __ch, int __radix) const
{
return __regex_traits_value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
return __value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
}
template <class _CharT> class __node;
template <class _BidirectionalIterator> class _LIBCPP_TYPE_VIS_ONLY sub_match;
template <class _BidirectionalIterator> class sub_match;
template <class _BidirectionalIterator,
class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
class _LIBCPP_TYPE_VIS_ONLY match_results;
class match_results;
template <class _CharT>
struct __state
@@ -2014,9 +2012,6 @@ public:
virtual void __exec(__state&) const;
};
template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<char>::__exec(__state&) const;
template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<wchar_t>::__exec(__state&) const;
// __match_char
template <class _CharT>
@@ -2418,7 +2413,7 @@ __exit:
template <class _CharT, class _Traits> class __lookahead;
template <class _CharT, class _Traits = regex_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_regex
class _LIBCPP_VISIBLE basic_regex
{
public:
// types:
@@ -2440,16 +2435,16 @@ private:
public:
// constants:
static const regex_constants::syntax_option_type icase = regex_constants::icase;
static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
static const regex_constants::syntax_option_type collate = regex_constants::collate;
static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
static const regex_constants::syntax_option_type basic = regex_constants::basic;
static const regex_constants::syntax_option_type extended = regex_constants::extended;
static const regex_constants::syntax_option_type awk = regex_constants::awk;
static const regex_constants::syntax_option_type grep = regex_constants::grep;
static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
static const/*expr*/ regex_constants::syntax_option_type icase = regex_constants::icase;
static const/*expr*/ regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
static const/*expr*/ regex_constants::syntax_option_type optimize = regex_constants::optimize;
static const/*expr*/ regex_constants::syntax_option_type collate = regex_constants::collate;
static const/*expr*/ regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
static const/*expr*/ regex_constants::syntax_option_type basic = regex_constants::basic;
static const/*expr*/ regex_constants::syntax_option_type extended = regex_constants::extended;
static const/*expr*/ regex_constants::syntax_option_type awk = regex_constants::awk;
static const/*expr*/ regex_constants::syntax_option_type grep = regex_constants::grep;
static const/*expr*/ regex_constants::syntax_option_type egrep = regex_constants::egrep;
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
@@ -2483,14 +2478,12 @@ public:
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
{__parse(__first, __last);}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_regex(initializer_list<value_type> __il,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
{__parse(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~basic_regex() = default;
@@ -2499,11 +2492,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex& operator=(const value_type* __p)
{return assign(__p);}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_regex& operator=(initializer_list<value_type> __il)
{return assign(__il);}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _ST, class _SA>
_LIBCPP_INLINE_VISIBILITY
basic_regex& operator=(const basic_string<value_type, _ST, _SA>& __p)
@@ -2513,11 +2504,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(const basic_regex& __that)
{return *this = __that;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(basic_regex&& __that) _NOEXCEPT
{return *this = _VSTD::move(__that);}
#endif
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
{return assign(__p, __p + __traits_.length(__p), __f);}
@@ -2569,18 +2555,13 @@ public:
{
__member_init(__f);
__parse(__first, __last);
return *this;
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(initializer_list<value_type> __il,
flag_type __f = regex_constants::ECMAScript)
{return assign(__il.begin(), __il.end(), __f);}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// const operations:
_LIBCPP_INLINE_VISIBILITY
unsigned mark_count() const {return __marked_count_;}
@@ -2772,7 +2753,7 @@ private:
void __push_end_marked_subexpression(unsigned);
void __push_empty();
void __push_word_boundary(bool);
void __push_lookahead(const basic_regex&, bool, unsigned);
void __push_lookahead(const basic_regex&, bool);
template <class _Allocator>
bool
@@ -2801,84 +2782,54 @@ private:
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool) const;
template <class _Bp, class _Ap, class _Cp, class _Tp>
template <class _B, class _A, class _C, class _T>
friend
bool
regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
regex_search(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&,
regex_constants::match_flag_type);
template <class _Ap, class _Cp, class _Tp>
template <class _A, class _C, class _T>
friend
bool
regex_search(const _Cp*, const _Cp*, match_results<const _Cp*, _Ap>&,
const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
regex_search(const _C*, const _C*, match_results<const _C*, _A>&,
const basic_regex<_C, _T>&, regex_constants::match_flag_type);
template <class _Bp, class _Cp, class _Tp>
template <class _B, class _C, class _T>
friend
bool
regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&,
regex_search(_B, _B, const basic_regex<_C, _T>&,
regex_constants::match_flag_type);
template <class _Cp, class _Tp>
template <class _C, class _T>
friend
bool
regex_search(const _Cp*, const _Cp*,
const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
regex_search(const _C*, const _C*,
const basic_regex<_C, _T>&, regex_constants::match_flag_type);
template <class _Cp, class _Ap, class _Tp>
template <class _C, class _A, class _T>
friend
bool
regex_search(const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&,
regex_search(const _C*, match_results<const _C*, _A>&, const basic_regex<_C, _T>&,
regex_constants::match_flag_type);
template <class _ST, class _SA, class _Cp, class _Tp>
template <class _ST, class _SA, class _C, class _T>
friend
bool
regex_search(const basic_string<_Cp, _ST, _SA>& __s,
const basic_regex<_Cp, _Tp>& __e,
regex_search(const basic_string<_C, _ST, _SA>& __s,
const basic_regex<_C, _T>& __e,
regex_constants::match_flag_type __flags);
template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
template <class _ST, class _SA, class _A, class _C, class _T>
friend
bool
regex_search(const basic_string<_Cp, _ST, _SA>& __s,
match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
const basic_regex<_Cp, _Tp>& __e,
regex_constants::match_flag_type __flags);
template <class _Iter, class _Ap, class _Cp, class _Tp>
friend
bool
regex_search(__wrap_iter<_Iter> __first,
__wrap_iter<_Iter> __last,
match_results<__wrap_iter<_Iter>, _Ap>& __m,
const basic_regex<_Cp, _Tp>& __e,
regex_search(const basic_string<_C, _ST, _SA>& __s,
match_results<typename basic_string<_C, _ST, _SA>::const_iterator, _A>&,
const basic_regex<_C, _T>& __e,
regex_constants::match_flag_type __flags);
template <class, class> friend class __lookahead;
};
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep;
template <class _CharT, class _Traits>
void
basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
@@ -2910,7 +2861,6 @@ class __lookahead
typedef __owns_one_state<_CharT> base;
basic_regex<_CharT, _Traits> __exp_;
unsigned __mexp_;
bool __invert_;
__lookahead(const __lookahead&);
@@ -2919,8 +2869,8 @@ public:
typedef _VSTD::__state<_CharT> __state;
_LIBCPP_INLINE_VISIBILITY
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
: base(__s), __exp_(__exp), __invert_(__invert), __mexp_(__mexp) {}
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s)
: base(__s), __exp_(__exp), __invert_(__invert) {}
virtual void __exec(__state&) const;
};
@@ -2934,14 +2884,11 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const
bool __matched = __exp_.__match_at_start_ecma(__s.__current_, __s.__last_,
__m,
__s.__flags_ | regex_constants::match_continuous,
__s.__at_first_ && __s.__current_ == __s.__first_);
true);
if (__matched != __invert_)
{
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
for (unsigned __i = 1; __i < __m.size(); ++__i) {
__s.__sub_matches_[__mexp_ + __i - 1] = __m.__matches_[__i];
}
}
else
{
@@ -3436,7 +3383,6 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,
case '+':
case '?':
case '{':
case '}':
__push_char(*__temp);
__first = ++__temp;
break;
@@ -3785,7 +3731,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
}
__ml->__add_range(_VSTD::move(__start_range), _VSTD::move(__end_range));
}
else if (!__start_range.empty())
else
{
if (__start_range.size() == 1)
__ml->__add_char(__start_range[0]);
@@ -3793,7 +3739,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
__ml->__add_digraph(__start_range[0], __start_range[1]);
}
}
else if (!__start_range.empty())
else
{
if (__start_range.size() == 1)
__ml->__add_char(__start_range[0]);
@@ -3920,7 +3866,7 @@ basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
{
__val = 8 * __val + *__first - '0';
if (++__first != __last && ('0' <= *__first && *__first <= '7'))
__val = 8 * __val + *__first++ - '0';
__val = 8 * __val + *__first - '0';
}
if (__str)
*__str = _CharT(__val);
@@ -4175,9 +4121,7 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
basic_regex __exp;
__exp.__flags_ = __flags_;
__temp = __exp.__parse(++__temp, __last);
unsigned __mexp = __exp.__marked_count_;
__push_lookahead(_VSTD::move(__exp), false, __marked_count_);
__marked_count_ += __mexp;
__push_lookahead(_VSTD::move(__exp), false);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
throw regex_error(regex_constants::error_paren);
@@ -4190,9 +4134,7 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
basic_regex __exp;
__exp.__flags_ = __flags_;
__temp = __exp.__parse(++__temp, __last);
unsigned __mexp = __exp.__marked_count_;
__push_lookahead(_VSTD::move(__exp), true, __marked_count_);
__marked_count_ += __mexp;
__push_lookahead(_VSTD::move(__exp), true);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
throw regex_error(regex_constants::error_paren);
@@ -4429,8 +4371,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
case 'c':
if ((__t = _VSTD::next(__first)) != __last)
{
if (('A' <= *__t && *__t <= 'Z') ||
('a' <= *__t && *__t <= 'z'))
if ('A' <= *__t <= 'Z' || 'a' <= *__t <= 'z')
{
if (__str)
*__str = _CharT(*__t % 32);
@@ -4438,15 +4379,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
__push_char(_CharT(*__t % 32));
__first = ++__t;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
break;
case 'u':
++__first;
@@ -4459,7 +4392,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + static_cast<unsigned>(__hd);
__sum = 16 * __sum + __hd;
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
@@ -4470,7 +4403,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + static_cast<unsigned>(__hd);
__sum = 16 * __sum + __hd;
// drop through
case 'x':
++__first;
@@ -4483,7 +4416,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + static_cast<unsigned>(__hd);
__sum = 16 * __sum + __hd;
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
@@ -4494,7 +4427,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + static_cast<unsigned>(__hd);
__sum = 16 * __sum + __hd;
if (__str)
*__str = _CharT(__sum);
else
@@ -4511,7 +4444,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
++__first;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
else if (__str)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
break;
@@ -4770,11 +4703,10 @@ basic_regex<_CharT, _Traits>::__start_matching_list(bool __negate)
template <class _CharT, class _Traits>
void
basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
bool __invert,
unsigned __mexp)
bool __invert)
{
__end_->first() = new __lookahead<_CharT, _Traits>(__exp, __invert,
__end_->first(), __mexp);
__end_->first());
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
@@ -4784,7 +4716,7 @@ typedef basic_regex<wchar_t> wregex;
// sub_match
template <class _BidirectionalIterator>
class _LIBCPP_TYPE_VIS_ONLY sub_match
class _LIBCPP_VISIBLE sub_match
: public pair<_BidirectionalIterator, _BidirectionalIterator>
{
public:
@@ -4796,7 +4728,7 @@ public:
bool matched;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR sub_match() : matched() {}
/*constexpr*/ sub_match() : matched() {}
_LIBCPP_INLINE_VISIBILITY
difference_type length() const
@@ -5207,7 +5139,7 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
}
template <class _BidirectionalIterator, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY match_results
class _LIBCPP_VISIBLE match_results
{
public:
typedef _Allocator allocator_type;
@@ -5270,11 +5202,11 @@ public:
const_reference suffix() const {return __suffix_;}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}
const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __matches_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin();}
const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __matches_.end();}
@@ -5319,12 +5251,12 @@ public:
// swap:
void swap(match_results& __m);
template <class _Bp, class _Ap>
template <class _B, class _A>
_LIBCPP_INLINE_VISIBILITY
void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l,
const match_results<_Bp, _Ap>& __m, bool __no_update_pos)
const match_results<_B, _A>& __m, bool __no_update_pos)
{
_Bp __mf = __m.prefix().first;
_B __mf = __m.prefix().first;
__matches_.resize(__m.size());
for (size_type __i = 0; __i < __matches_.size(); ++__i)
{
@@ -5353,16 +5285,16 @@ private:
template <class, class> friend class basic_regex;
template <class _Bp, class _Ap, class _Cp, class _Tp>
template <class _B, class _A, class _C, class _T>
friend
bool
regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
regex_match(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&,
regex_constants::match_flag_type);
template <class _Bp, class _Ap>
template <class _B, class _A>
friend
bool
operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&);
operator==(const match_results<_B, _A>&, const match_results<_B, _A>&);
template <class, class> friend class __lookahead;
};
@@ -5552,6 +5484,8 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
regex_constants::match_flag_type __flags, bool __at_first) const
{
vector<__state> __states;
ptrdiff_t __j = 0;
ptrdiff_t _N = _VSTD::distance(__first, __last);
__node* __st = __start_.get();
if (__st)
{
@@ -5565,6 +5499,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
__states.back().__node_ = __st;
__states.back().__flags_ = __flags;
__states.back().__at_first_ = __at_first;
bool __matched = false;
do
{
__state& __s = __states.back();
@@ -5616,7 +5551,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
{
deque<__state> __states;
ptrdiff_t __highest_j = 0;
ptrdiff_t _Np = _VSTD::distance(__first, __last);
ptrdiff_t _N = _VSTD::distance(__first, __last);
__node* __st = __start_.get();
if (__st)
{
@@ -5641,7 +5576,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
if (!__matched || __highest_j < __s.__current_ - __s.__first_)
__highest_j = __s.__current_ - __s.__first_;
__matched = true;
if (__highest_j == _Np)
if (__highest_j == _N)
__states.clear();
else
__states.pop_back();
@@ -5696,7 +5631,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__state __best_state;
ptrdiff_t __j = 0;
ptrdiff_t __highest_j = 0;
ptrdiff_t _Np = _VSTD::distance(__first, __last);
ptrdiff_t _N = _VSTD::distance(__first, __last);
__node* __st = __start_.get();
if (__st)
{
@@ -5726,7 +5661,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__best_state = __s;
}
__matched = true;
if (__highest_j == _Np)
if (__highest_j == _N)
__states.clear();
else
__states.pop_back();
@@ -5794,8 +5729,7 @@ basic_regex<_CharT, _Traits>::__search(
{
__m.__init(1 + mark_count(), __first, __last,
__flags & regex_constants::__no_update_pos);
if (__match_at_start(__first, __last, __m, __flags,
!(__flags & regex_constants::__no_update_pos)))
if (__match_at_start(__first, __last, __m, __flags, true))
{
__m.__prefix_.second = __m[0].first;
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
@@ -5832,25 +5766,9 @@ regex_search(_BidirectionalIterator __first, _BidirectionalIterator __last,
const basic_regex<_CharT, _Traits>& __e,
regex_constants::match_flag_type __flags = regex_constants::match_default)
{
int __offset = (__flags & regex_constants::match_prev_avail) ? 1 : 0;
basic_string<_CharT> __s(_VSTD::prev(__first, __offset), __last);
basic_string<_CharT> __s(__first, __last);
match_results<const _CharT*> __mc;
bool __r = __e.__search(__s.data() + __offset, __s.data() + __s.size(), __mc, __flags);
__m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
return __r;
}
template <class _Iter, class _Allocator, class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
bool
regex_search(__wrap_iter<_Iter> __first,
__wrap_iter<_Iter> __last,
match_results<__wrap_iter<_Iter>, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
regex_constants::match_flag_type __flags = regex_constants::match_default)
{
match_results<const _CharT*> __mc;
bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags);
bool __r = __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
__m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
return __r;
}
@@ -6010,7 +5928,7 @@ regex_match(const basic_string<_CharT, _ST, _SA>& __s,
template <class _BidirectionalIterator,
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY regex_iterator
class _LIBCPP_VISIBLE regex_iterator
{
public:
typedef basic_regex<_CharT, _Traits> regex_type;
@@ -6092,7 +6010,7 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
{
__flags_ |= regex_constants::__no_update_pos;
_BidirectionalIterator __start = __match_[0].second;
if (__match_.empty())
if (__match_.length() == 0)
{
if (__start == __end_)
{
@@ -6122,7 +6040,7 @@ typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
template <class _BidirectionalIterator,
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY regex_token_iterator
class _LIBCPP_VISIBLE regex_token_iterator
{
public:
typedef basic_regex<_CharT, _Traits> regex_type;
@@ -6151,18 +6069,16 @@ public:
const regex_type& __re, const vector<int>& __submatches,
regex_constants::match_flag_type __m =
regex_constants::match_default);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type& __re,
initializer_list<int> __submatches,
regex_constants::match_flag_type __m =
regex_constants::match_default);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <size_t _Np>
template <size_t _N>
regex_token_iterator(_BidirectionalIterator __a,
_BidirectionalIterator __b,
const regex_type& __re,
const int (&__submatches)[_Np],
const int (&__submatches)[_N],
regex_constants::match_flag_type __m =
regex_constants::match_default);
regex_token_iterator(const regex_token_iterator&);
@@ -6246,8 +6162,6 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
__init(__a, __b);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
@@ -6261,18 +6175,16 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
__init(__a, __b);
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _BidirectionalIterator, class _CharT, class _Traits>
template <size_t _Np>
template <size_t _N>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type& __re,
const int (&__submatches)[_Np],
const int (&__submatches)[_N],
regex_constants::match_flag_type __m)
: __position_(__a, __b, __re, __m),
_N_(0),
__subs_(__submatches, __submatches + _Np)
__subs_(__submatches, __submatches + _N)
{
__init(__a, __b);
}

View File

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

View File

@@ -66,11 +66,6 @@ public:
set(initializer_list<value_type> il, const value_compare& comp = value_compare());
set(initializer_list<value_type> il, const value_compare& comp,
const allocator_type& a);
template <class InputIterator>
set(InputIterator first, InputIterator last, const allocator_type& a)
: set(first, last, Compare(), a) {} // C++14
set(initializer_list<value_type> il, const allocator_type& a)
: set(il, Compare(), a) {} // C++14
~set();
set& operator=(const set& s);
@@ -134,33 +129,13 @@ public:
// set operations:
iterator find(const key_type& k);
const_iterator find(const key_type& k) const;
template<typename K>
iterator find(const K& x);
template<typename K>
const_iterator find(const K& x) const; // C++14
template<typename K>
size_type count(const K& x) const; // C++14
size_type count(const key_type& k) const;
iterator lower_bound(const key_type& k);
const_iterator lower_bound(const key_type& k) const;
template<typename K>
iterator lower_bound(const K& x); // C++14
template<typename K>
const_iterator lower_bound(const K& x) const; // C++14
iterator upper_bound(const key_type& k);
const_iterator upper_bound(const key_type& k) const;
template<typename K>
iterator upper_bound(const K& x); // C++14
template<typename K>
const_iterator upper_bound(const K& x) const; // C++14
pair<iterator,iterator> equal_range(const key_type& k);
pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
template<typename K>
pair<iterator,iterator> equal_range(const K& x); // C++14
template<typename K>
pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
};
template <class Key, class Compare, class Allocator>
@@ -247,11 +222,6 @@ public:
multiset(initializer_list<value_type> il, const value_compare& comp = value_compare());
multiset(initializer_list<value_type> il, const value_compare& comp,
const allocator_type& a);
template <class InputIterator>
multiset(InputIterator first, InputIterator last, const allocator_type& a)
: set(first, last, Compare(), a) {} // C++14
multiset(initializer_list<value_type> il, const allocator_type& a)
: set(il, Compare(), a) {} // C++14
~multiset();
multiset& operator=(const multiset& s);
@@ -315,32 +285,13 @@ public:
// set operations:
iterator find(const key_type& k);
const_iterator find(const key_type& k) const;
template<typename K>
iterator find(const K& x);
template<typename K>
const_iterator find(const K& x) const; // C++14
size_type count(const key_type& k) const;
iterator lower_bound(const key_type& k);
const_iterator lower_bound(const key_type& k) const;
template<typename K>
iterator lower_bound(const K& x); // C++14
template<typename K>
const_iterator lower_bound(const K& x) const; // C++14
iterator upper_bound(const key_type& k);
const_iterator upper_bound(const key_type& k) const;
template<typename K>
iterator upper_bound(const K& x); // C++14
template<typename K>
const_iterator upper_bound(const K& x) const; // C++14
pair<iterator,iterator> equal_range(const key_type& k);
pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
template<typename K>
pair<iterator,iterator> equal_range(const K& x); // C++14
template<typename K>
pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
};
template <class Key, class Compare, class Allocator>
@@ -387,15 +338,13 @@ swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
#include <__tree>
#include <functional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class _LIBCPP_TYPE_VIS_ONLY set
class _LIBCPP_VISIBLE set
{
public:
// types:
@@ -452,13 +401,6 @@ public:
insert(__f, __l);
}
#if _LIBCPP_STD_VER > 11
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
: set(__f, __l, key_compare(), __a) {}
#endif
_LIBCPP_INLINE_VISIBILITY
set(const set& __s)
: __tree_(__s.__tree_)
@@ -495,7 +437,6 @@ public:
set(set&& __s, const allocator_type& __a);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -511,19 +452,12 @@ public:
insert(__il.begin(), __il.end());
}
#if _LIBCPP_STD_VER > 11
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const allocator_type& __a)
: set(__il, key_compare(), __a) {}
#endif
_LIBCPP_INLINE_VISIBILITY
set& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_unique(__il.begin(), __il.end());
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -608,11 +542,9 @@ public:
__tree_.__insert_unique(__e, *__f);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
@@ -641,17 +573,6 @@ public:
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
find(const _K2& __k) {return __tree_.find(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
find(const _K2& __k) const {return __tree_.find(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_unique(__k);}
@@ -661,51 +582,18 @@ public:
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_unique(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);}
#endif
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -791,7 +679,7 @@ swap(set<_Key, _Compare, _Allocator>& __x,
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class _LIBCPP_TYPE_VIS_ONLY multiset
class _LIBCPP_VISIBLE multiset
{
public:
// types:
@@ -840,13 +728,6 @@ public:
insert(__f, __l);
}
#if _LIBCPP_STD_VER > 11
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
: multiset(__f, __l, key_compare(), __a) {}
#endif
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l,
@@ -890,7 +771,6 @@ public:
multiset(multiset&& __s, const allocator_type& __a);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -906,19 +786,12 @@ public:
insert(__il.begin(), __il.end());
}
#if _LIBCPP_STD_VER > 11
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const allocator_type& __a)
: multiset(__il, key_compare(), __a) {}
#endif
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_multi(__il.begin(), __il.end());
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -1003,11 +876,9 @@ public:
__tree_.__insert_multi(__e, *__f);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
@@ -1036,72 +907,27 @@ public:
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
find(const _K2& __k) {return __tree_.find(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
find(const _K2& __k) const {return __tree_.find(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_multi(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
#endif
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1,99 +0,0 @@
// -*- C++ -*-
//===--------------------- support/ibm/limits.h ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_IBM_LIMITS_H
#define _LIBCPP_SUPPORT_IBM_LIMITS_H
#if !defined(_AIX) // Linux
#include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN
static const unsigned int _QNAN_F = 0x7fc00000;
#define NANF (*((float *)(&_QNAN_F)))
static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0};
#define NANL (*((long double *)(&_QNAN_LDBL128)))
static const unsigned int _SNAN_F= 0x7f855555;
#define NANSF (*((float *)(&_SNAN_F)))
static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555};
#define NANS (*((double *)(&_SNAN_D)))
static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0};
#define NANSL (*((long double *)(&_SNAN_LDBL128)))
#define __builtin_huge_val() HUGE_VAL
#define __builtin_huge_valf() HUGE_VALF
#define __builtin_huge_vall() HUGE_VALL
#define __builtin_nan(__dummy) NAN
#define __builtin_nanf(__dummy) NANF
#define __builtin_nanl(__dummy) NANL
#define __builtin_nans(__dummy) NANS
#define __builtin_nansf(__dummy) NANSF
#define __builtin_nansl(__dummy) NANSL
#else
#include <math.h>
#include <float.h> // limit constants
#define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000
#define __builtin_huge_valf() HUGE_VALF //0x7f800000
#define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000
#define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000
#define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000
#define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000
#define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555
#define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555
#define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555
#define __FLT_MANT_DIG__ FLT_MANT_DIG
#define __FLT_DIG__ FLT_DIG
#define __FLT_RADIX__ FLT_RADIX
#define __FLT_MIN_EXP__ FLT_MIN_EXP
#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
#define __FLT_MAX_EXP__ FLT_MAX_EXP
#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
#define __FLT_MIN__ FLT_MIN
#define __FLT_MAX__ FLT_MAX
#define __FLT_EPSILON__ FLT_EPSILON
// predefined by XLC on LoP
#define __FLT_DENORM_MIN__ 1.40129846e-45F
#define __DBL_MANT_DIG__ DBL_MANT_DIG
#define __DBL_DIG__ DBL_DIG
#define __DBL_MIN_EXP__ DBL_MIN_EXP
#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
#define __DBL_MAX_EXP__ DBL_MAX_EXP
#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
#define __DBL_MIN__ DBL_MIN
#define __DBL_MAX__ DBL_MAX
#define __DBL_EPSILON__ DBL_EPSILON
// predefined by XLC on LoP
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
#define __LDBL_DIG__ LDBL_DIG
#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
#define __LDBL_MIN__ LDBL_MIN
#define __LDBL_MAX__ LDBL_MAX
#define __LDBL_EPSILON__ LDBL_EPSILON
// predefined by XLC on LoP
#if __LONGDOUBLE128
#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
#else
#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
#endif
// predefined by XLC on LoP
#define __CHAR_BIT__ 8
#endif // _AIX
#endif // _LIBCPP_SUPPORT_IBM_LIMITS_H

View File

@@ -1,54 +0,0 @@
// -*- C++ -*-
//===----------------------- support/ibm/support.h ----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_IBM_SUPPORT_H
#define _LIBCPP_SUPPORT_IBM_SUPPORT_H
extern "builtin" int __popcnt4(unsigned int);
extern "builtin" int __popcnt8(unsigned long long);
extern "builtin" unsigned int __cnttz4(unsigned int);
extern "builtin" unsigned int __cnttz8(unsigned long long);
extern "builtin" unsigned int __cntlz4(unsigned long long);
extern "builtin" unsigned int __cntlz8(unsigned long long);
// Builtin functions for counting population
#define __builtin_popcount(x) __popcnt4(x)
#define __builtin_popcountll(x) __popcnt8(x)
#if defined(__64BIT__)
#define __builtin_popcountl(x) __builtin_popcountll(x)
#else
#define __builtin_popcountl(x) __builtin_popcount(x)
#endif
// Builtin functions for counting trailing zeros
#define __builtin_ctz(x) __cnttz4(x)
#define __builtin_ctzll(x) __cnttz8(x)
#if defined(__64BIT__)
#define __builtin_ctzl(x) __builtin_ctzll(x)
#else
#define __builtin_ctzl(x) __builtin_ctz(x)
#endif
// Builtin functions for counting leading zeros
#define __builtin_clz(x) __cntlz4(x)
#define __builtin_clzll(x) __cntlz8(x)
#if defined(__64BIT__)
#define __builtin_clzl(x) __builtin_clzll(x)
#else
#define __builtin_clzl(x) __builtin_clz(x)
#endif
#if defined(__64BIT__)
#define __SIZE_WIDTH__ 64
#else
#define __SIZE_WIDTH__ 32
#endif
#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H

View File

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

View File

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

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