Compare commits

..

1 Commits

Author SHA1 Message Date
Howard Hinnant
514aeaef73 Tagging 11
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/tags/libcpp-11@121003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 15:24:26 +00:00
144 changed files with 13170 additions and 5948 deletions

View File

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

View File

@@ -12,7 +12,4 @@ N: Howard Hinnant
E: hhinnant@apple.com
D: Architect and primary author of libc++
N: Marshall Clow
E: marshall@idio.com
E: mclow@qualcomm.com
D: Minor patches and bug fixes.

View File

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

View File

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

View File

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

View File

@@ -82,7 +82,7 @@
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
#if defined(__clang__)
@@ -148,15 +148,22 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#endif
// Inline namespaces are available in Clang regardless of C++ dialect.
#if __has_feature(cxx_inline_namespaces)
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _STD std::_LIBCPP_NAMESPACE
namespace std {
inline namespace _LIBCPP_NAMESPACE {
}
inline namespace _LIBCPP_NAMESPACE {
}
using namespace _LIBCPP_NAMESPACE;
}
#else // __has_feature(cxx_inline_namespaces)
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
#define _STD std
#endif // __has_feature(cxx_inline_namespaces)
#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
@@ -184,12 +191,10 @@ namespace std {
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#else // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

@@ -29,9 +29,9 @@ template <class _NodePtr>
struct __hash_node_base
{
typedef __hash_node_base __first_node;
// typedef _NodePtr pointer;
typedef _NodePtr pointer;
_NodePtr __next_;
pointer __next_;
_LIBCPP_INLINE_VISIBILITY __hash_node_base() : __next_(nullptr) {}
};
@@ -85,7 +85,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return _STD::addressof(__node_->__value_);}
pointer operator->() const {return addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__hash_iterator& operator++()
@@ -163,7 +163,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return _STD::addressof(__node_->__value_);}
pointer operator->() const {return addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator& operator++()
@@ -433,7 +433,7 @@ public:
void operator()(pointer __p)
{
if (__value_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
__alloc_traits::destroy(__na_, addressof(__p->__value_));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -798,7 +798,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
if (size() > 0)
{
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
static_cast<__node_pointer>(addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
@@ -822,7 +822,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
__p1_.first().__next_ = __u.__p1_.first().__next_;
__u.__p1_.first().__next_ = nullptr;
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
static_cast<__node_pointer>(addressof(__p1_.first()));
size() = __u.size();
__u.size() = 0;
}
@@ -875,7 +875,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate(__node_pointer __np)
while (__np != nullptr)
{
__node_pointer __next = __np->__next_;
__node_traits::destroy(__na, _STD::addressof(__np->__value_));
__node_traits::destroy(__na, addressof(__np->__value_));
__node_traits::deallocate(__na, __np, 1);
__np = __next;
}
@@ -914,7 +914,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
if (size() > 0)
{
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
static_cast<__node_pointer>(addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
@@ -1131,7 +1131,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
__nd->__next_ = __pn->__next_;
__pn->__next_ = __nd;
// fix up __bucket_list_
@@ -1169,7 +1169,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
__cp->__next_ = __pn->__next_;
__pn->__next_ = __cp;
// fix up __bucket_list_
@@ -1275,7 +1275,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
__h->__next_ = __pn->__next_;
__pn->__next_ = __h.get();
// fix up __bucket_list_
@@ -1433,7 +1433,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
{
for (size_type __i = 0; __i < __nbc; ++__i)
__bucket_list_[__i] = nullptr;
__node_pointer __pp(static_cast<__node_pointer>(_STD::addressof(__p1_.first())));
__node_pointer __pp(static_cast<__node_pointer>(addressof(__p1_.first())));
__node_pointer __cp = __pp->__next_;
if (__cp != nullptr)
{
@@ -1533,7 +1533,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
@@ -1549,7 +1549,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v,
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::move(__v));
__node_traits::construct(__na, addressof(__h->__value_), _STD::move(__v));
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
@@ -1564,7 +1564,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__na, addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
@@ -1580,7 +1580,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__na, addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
@@ -1658,7 +1658,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p)
// Fix up __bucket_list_
// if __pn is not in same bucket (before begin is not in same bucket) &&
// if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
if (__pn == _STD::addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
if (__pn == addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
{
if (__cn->__next_ == nullptr || __cn->__next_->__hash_ % __bc != __chash)
__bucket_list_[__chash] = nullptr;
@@ -1791,10 +1791,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
__p3_.swap(__u.__p3_);
if (size() > 0)
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
static_cast<__node_pointer>(addressof(__p1_.first()));
if (__u.size() > 0)
__u.__bucket_list_[__u.__p1_.first().__next_->__hash_ % __u.bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__u.__p1_.first()));
static_cast<__node_pointer>(addressof(__u.__p1_.first()));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>

View File

@@ -55,8 +55,7 @@ public:
explicit locale(const string&);
locale(const locale&, const char*, category);
locale(const locale&, const string&, category);
template <class _Facet>
_LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
template <class _Facet> locale(const locale&, _Facet*);
locale(const locale&, const locale&, category);
~locale() throw();

View File

@@ -85,20 +85,22 @@ public:
void shrink_to_fit();
void push_front(const_reference __x);
void push_back(const_reference __x);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void push_front(value_type&& __x);
void push_back(value_type&& __x);
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
void emplace_back(_Args&&... __args);
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
void __construct_at_end(size_type __n);
void __construct_at_end(size_type __n, false_type);
void __construct_at_end(size_type __n, true_type);
void __construct_at_end(size_type __n, const_reference __x);
void __construct_at_end(size_type __n, const_reference __x, false_type);
void __construct_at_end(size_type __n, const_reference __x, true_type);
template <class _InputIter>
typename enable_if
<
@@ -188,8 +190,16 @@ __split_buffer<_Tp, _Allocator>::__invariants() const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
{
__construct_at_end(__n, __is_zero_default_constructible<value_type>());
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
{
__alloc_rr& __a = this->__alloc();
do
@@ -200,6 +210,15 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
{
_STD::memset(this->__end_, 0, __n*sizeof(value_type));
this->__end_ += __n;
}
// Copy constructs __n objects starting at __end_ from __x
// throws if construction throws
// Precondition: __n > 0
@@ -207,8 +226,17 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
__construct_at_end(__n, __x, integral_constant<bool, is_trivially_copy_constructible<value_type>::value &&
is_trivially_copy_assignable<value_type>::value>());
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
{
__alloc_rr& __a = this->__alloc();
do
@@ -219,6 +247,15 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_referen
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
{
_STD::fill_n(this->__end_, __n, __x);
this->__end_ += __n;
}
template <class _Tp, class _Allocator>
template <class _InputIter>
typename enable_if

View File

@@ -97,7 +97,7 @@ typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::__getchar(bool __consume)
{
char __extbuf[__limit];
int __nread = _STD::max(1, __encoding_);
int __nread = max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i)
{
char __c = getc(__file_);

View File

@@ -523,7 +523,7 @@ public:
void operator()(pointer __p)
{
if (__value_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
__alloc_traits::destroy(__na_, addressof(__p->__value_));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -769,7 +769,6 @@ public:
typedef typename __alloc_traits::difference_type difference_type;
typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>
@@ -780,10 +779,10 @@ public:
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer;
typedef typename __node_base::pointer __node_base_pointer;
typedef typename __node_base::const_pointer __node_base_const_pointer;
typedef typename __node::base::pointer __node_base_pointer;
typedef typename __node::base::const_pointer __node_base_const_pointer;
private:
typedef typename __node_base::base __end_node_t;
typedef typename __node::base::base __end_node_t;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__end_node_t>
@@ -911,12 +910,13 @@ public:
iterator __insert_multi(_V&& __v);
template <class _V>
iterator __insert_multi(const_iterator __p, _V&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __insert_unique(const value_type& __v);
iterator __insert_unique(const_iterator __p, const value_type& __v);
iterator __insert_multi(const value_type& __v);
iterator __insert_multi(const_iterator __p, const value_type& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
iterator __node_insert_unique(const_iterator __p,
@@ -997,19 +997,19 @@ public:
__node_holder remove(const_iterator __p);
private:
typename __node_base::pointer&
__find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v);
typename __node_base::pointer&
__find_leaf_high(typename __node_base::pointer& __parent, const value_type& __v);
typename __node_base::pointer&
typename __node::base::pointer&
__find_leaf_low(typename __node::base::pointer& __parent, const value_type& __v);
typename __node::base::pointer&
__find_leaf_high(typename __node::base::pointer& __parent, const value_type& __v);
typename __node::base::pointer&
__find_leaf(const_iterator __hint,
typename __node_base::pointer& __parent, const value_type& __v);
typename __node::base::pointer& __parent, const value_type& __v);
template <class _Key>
typename __node_base::pointer&
__find_equal(typename __node_base::pointer& __parent, const _Key& __v);
typename __node::base::pointer&
__find_equal(typename __node::base::pointer& __parent, const _Key& __v);
template <class _Key>
typename __node_base::pointer&
__find_equal(const_iterator __hint, typename __node_base::pointer& __parent,
typename __node::base::pointer&
__find_equal(const_iterator __hint, typename __node::base::pointer& __parent,
const _Key& __v);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
@@ -1373,7 +1373,7 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd)
destroy(static_cast<__node_pointer>(__nd->__left_));
destroy(static_cast<__node_pointer>(__nd->__right_));
__node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, _STD::addressof(__nd->__value_));
__node_traits::destroy(__na, addressof(__nd->__value_));
__node_traits::deallocate(__na, __nd, 1);
}
}
@@ -1411,8 +1411,8 @@ __tree<_Tp, _Compare, _Allocator>::clear()
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node::base::pointer& __parent,
const value_type& __v)
{
__node_pointer __nd = __root();
@@ -1450,8 +1450,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node::base::pointer& __parent,
const value_type& __v)
{
__node_pointer __nd = __root();
@@ -1492,9 +1492,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointe
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
typename __node_base::pointer& __parent,
typename __node::base::pointer& __parent,
const value_type& __v)
{
if (__hint == end() || !value_comp()(*__hint, __v)) // check before
@@ -1528,8 +1528,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
// If __v exists, set parent to node of __v and return reference to node of __v
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node::base::pointer& __parent,
const _Key& __v)
{
__node_pointer __nd = __root();
@@ -1577,9 +1577,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& _
// If __v exists, set parent to node of __v and return reference to node of __v
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
typename __node_base::pointer& __parent,
typename __node::base::pointer& __parent,
const _Key& __v)
{
if (__hint == end() || value_comp()(__v, *__hint)) // check before
@@ -1655,7 +1655,7 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
return __h;
}
@@ -1728,11 +1728,18 @@ template <class _V>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
return __r;
__node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__parent, __v);
__node_pointer __r = static_cast<__node_pointer>(__child);
bool __inserted = false;
if (__child == nullptr)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
__inserted = true;
}
return pair<iterator, bool>(iterator(__r), __inserted);
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1740,11 +1747,16 @@ template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
iterator __r = __node_insert_unique(__p, __h.get());
if (__r.__ptr_ == __h.get())
__h.release();
return __r;
__node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__p, __parent, __v);
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
}
return iterator(__r);
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1779,13 +1791,11 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__na, addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
return _STD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
@@ -1842,6 +1852,8 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
return iterator(__h.release());
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
@@ -1907,7 +1919,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
__begin_node() = __r.__ptr_;
--size();
__node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, const_cast<value_type*>(_STD::addressof(*__p)));
__node_traits::destroy(__na, const_cast<value_type*>(addressof(*__p)));
__tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np));
__node_traits::deallocate(__na, __np, 1);

View File

@@ -68,24 +68,23 @@ template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
template <class _Tp> struct __tuple_like : false_type {};
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
template <class... _Tp> struct __tuple_like<tuple<_Tp...>> : true_type {};
template <class... _Tp> struct __tuple_like<const tuple<_Tp...>> : true_type {};
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
template <class _T1, class _T2> struct __tuple_like<const pair<_T1, _T2> > : true_type {};
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
template <class _Tp, size_t _Size> struct __tuple_like<const array<_Tp, _Size> > : true_type {};
template <size_t _Ip, class ..._Tp>
typename tuple_element<_Ip, tuple<_Tp...> >::type&
typename tuple_element<_Ip, tuple<_Tp...>>::type&
get(tuple<_Tp...>&);
template <size_t _Ip, class ..._Tp>
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
get(const tuple<_Tp...>&);
template <size_t _Ip, class ..._Tp>
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
typename tuple_element<_Ip, tuple<_Tp...>>::type&&
get(tuple<_Tp...>&&);
template <size_t _Ip, class _T1, class _T2>
@@ -143,7 +142,7 @@ struct __make_tuple_indices
template <class ..._Tp> struct __tuple_types {};
template <size_t _Ip>
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<>>
{
public:
static_assert(_Ip == 0, "tuple_element index out of range");
@@ -151,26 +150,26 @@ public:
};
template <class _Hp, class ..._Tp>
class _LIBCPP_VISIBLE 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_VISIBLE 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;
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...>>::type type;
};
template <class ..._Tp>
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...>>
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...>> : true_type {};
// __make_tuple_types
@@ -212,17 +211,13 @@ template <bool, class _Tp, class _Up>
struct __tuple_convertible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...>>
: public integral_constant<bool,
#if 1 // waiting on cwg 1170
is_convertible<_Tp0, _Up0>::value &&
#else
is_constructible<_Up0, _Tp0>::value &&
#endif
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...>>::value> {};
template <>
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<>>
: public true_type {};
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
@@ -243,13 +238,13 @@ template <bool, class _Tp, class _Up>
struct __tuple_assignable_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...>>
: public integral_constant<bool,
is_assignable<_Up0&, _Tp0>::value &&
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...>>::value> {};
template <>
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<>>
: public true_type {};
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,

View File

@@ -1559,17 +1559,8 @@ typename enable_if
>::type
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
{
if (__n > 0)
{
for (; __n > 0; --__n, ++__first, ++__result)
*__result = *__first;
++__result;
for (--__n; __n > 0; --__n)
{
++__first;
*__result = *__first;
++__result;
}
}
return __result;
}
@@ -1582,7 +1573,7 @@ typename enable_if
>::type
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
{
return _STD::copy(__first, __first + __n, __result);
return copy(__first, __first + __n, __result);
}
// move

File diff suppressed because it is too large Load Diff

View File

@@ -603,7 +603,7 @@ copy_backward(_RAIter __f,
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
while (__f != __l)
{
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _STD::prev(__r);
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = prev(__r);
pointer __rb = *__rp.__m_iter_;
pointer __re = __rp.__ptr_ + 1;
difference_type __bs = __re - __rb;
@@ -776,7 +776,7 @@ move_backward(_RAIter __f,
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
while (__f != __l)
{
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _STD::prev(__r);
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = prev(__r);
pointer __rb = *__rp.__m_iter_;
pointer __re = __rp.__ptr_ + 1;
difference_type __bs = __re - __rb;
@@ -1116,7 +1116,7 @@ __deque_base<_Tp, _Allocator>::clear()
{
allocator_type& __a = __alloc();
for (iterator __i = begin(), __e = end(); __i != __e; ++__i)
__alloc_traits::destroy(__a, _STD::addressof(*__i));
__alloc_traits::destroy(__a, addressof(*__i));
size() = 0;
while (__map_.size() > 2)
{
@@ -1675,7 +1675,7 @@ deque<_Tp, _Allocator>::push_back(const value_type& __v)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), __v);
__alloc_traits::construct(__a, addressof(*__base::end()), __v);
++__base::size();
}
@@ -1689,7 +1689,7 @@ deque<_Tp, _Allocator>::push_back(value_type&& __v)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::move(__v));
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::move(__v));
++__base::size();
}
@@ -1704,7 +1704,7 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::forward<_Args>(__args)...);
++__base::size();
}
@@ -1719,7 +1719,7 @@ deque<_Tp, _Allocator>::push_front(const value_type& __v)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), __v);
__alloc_traits::construct(__a, addressof(*--__base::begin()), __v);
--__base::__start_;
++__base::size();
}
@@ -1734,7 +1734,7 @@ deque<_Tp, _Allocator>::push_front(value_type&& __v)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::move(__v));
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::move(__v));
--__base::__start_;
++__base::size();
}
@@ -1750,7 +1750,7 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
--__base::__start_;
++__base::size();
}
@@ -1772,7 +1772,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), __v);
__alloc_traits::construct(__a, addressof(*--__base::begin()), __v);
--__base::__start_;
++__base::size();
}
@@ -1780,10 +1780,10 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
{
const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __b = __base::begin();
iterator __bm1 = _STD::prev(__b);
iterator __bm1 = prev(__b);
if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
__vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
__alloc_traits::construct(__a, addressof(*__bm1), _STD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
@@ -1799,17 +1799,17 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), __v);
__alloc_traits::construct(__a, addressof(*__base::end()), __v);
++__base::size();
}
else
{
const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __e = __base::end();
iterator __em1 = _STD::prev(__e);
iterator __em1 = prev(__e);
if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
__vt = pointer_traits<const_pointer>::pointer_to(*__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
__alloc_traits::construct(__a, addressof(*__e), _STD::move(*__em1));
++__base::size();
if (__de > 1)
__e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
@@ -1835,15 +1835,15 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::move(__v));
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::move(__v));
--__base::__start_;
++__base::size();
}
else
{
iterator __b = __base::begin();
iterator __bm1 = _STD::prev(__b);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
iterator __bm1 = prev(__b);
__alloc_traits::construct(__a, addressof(*__bm1), _STD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
@@ -1859,14 +1859,14 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::move(__v));
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::move(__v));
++__base::size();
}
else
{
iterator __e = __base::end();
iterator __em1 = _STD::prev(__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
iterator __em1 = prev(__e);
__alloc_traits::construct(__a, addressof(*__e), _STD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _STD::move_backward(__e - __de, __em1, __e);
@@ -1893,15 +1893,15 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
--__base::__start_;
++__base::size();
}
else
{
iterator __b = __base::begin();
iterator __bm1 = _STD::prev(__b);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
iterator __bm1 = prev(__b);
__alloc_traits::construct(__a, addressof(*__bm1), _STD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
@@ -1917,14 +1917,14 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::forward<_Args>(__args)...);
++__base::size();
}
else
{
iterator __e = __base::end();
iterator __em1 = _STD::prev(__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
iterator __em1 = prev(__e);
__alloc_traits::construct(__a, addressof(*__e), _STD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _STD::move_backward(__e - __de, __em1, __e);
@@ -1955,7 +1955,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __pos)
{
for (size_type __m = __n - __pos; __m; --__m, --__base::__start_, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*--__i), __v);
__alloc_traits::construct(__a, addressof(*--__i), __v);
__n = __pos;
}
if (__n > 0)
@@ -1981,7 +1981,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __de)
{
for (size_type __m = __n - __de; __m; --__m, ++__i, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), __v);
__alloc_traits::construct(__a, addressof(*__i), __v);
__n = __de;
}
if (__n > 0)
@@ -2033,7 +2033,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
{
__m = __pos < __n / 2 ? _STD::prev(__l, __pos) : _STD::next(__f, __n - __pos);
for (_BiIter __j = __m; __j != __f; --__base::__start_, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*--__i), *--__j);
__alloc_traits::construct(__a, addressof(*--__i), *--__j);
__n = __pos;
}
if (__n > 0)
@@ -2041,7 +2041,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
iterator __obn = __old_begin + __n;
for (iterator __j = __obn; __j != __old_begin;)
{
__alloc_traits::construct(__a, _STD::addressof(*--__i), _STD::move(*--__j));
__alloc_traits::construct(__a, addressof(*--__i), _STD::move(*--__j));
--__base::__start_;
++__base::size();
}
@@ -2065,14 +2065,14 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
{
__m = __de < __n / 2 ? _STD::next(__f, __de) : _STD::prev(__l, __n - __de);
for (_BiIter __j = __m; __j != __l; ++__i, ++__j, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), *__j);
__alloc_traits::construct(__a, addressof(*__i), *__j);
__n = __de;
}
if (__n > 0)
{
iterator __oen = __old_end - __n;
for (iterator __j = __oen; __j != __old_end; ++__i, ++__j, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), _STD::move(*__j));
__alloc_traits::construct(__a, addressof(*__i), _STD::move(*__j));
if (__n < __de)
__old_end = _STD::move_backward(__old_end - __de, __oen, __old_end);
_STD::copy_backward(__f, __m, __old_end);
@@ -2105,7 +2105,7 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
for (iterator __i = __base::end(); __f != __l; ++__i, ++__f, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), *__f);
__alloc_traits::construct(__a, addressof(*__i), *__f);
}
template <class _Tp, class _Allocator>
@@ -2118,7 +2118,7 @@ deque<_Tp, _Allocator>::__append(size_type __n)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i));
__alloc_traits::construct(__a, addressof(*__i));
}
template <class _Tp, class _Allocator>
@@ -2131,7 +2131,7 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), __v);
__alloc_traits::construct(__a, addressof(*__i), __v);
}
// Create front capacity for one block of elements.
@@ -2209,7 +2209,7 @@ deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
size_type __nb = __recommend_blocks(__n + __base::__map_.empty());
// Number of unused blocks at back:
size_type __back_capacity = __back_spare() / __base::__block_size;
__back_capacity = _STD::min(__back_capacity, __nb); // don't take more than you need
__back_capacity = min(__back_capacity, __nb); // don't take more than you need
__nb -= __back_capacity; // number of blocks need to allocate
// If __nb == 0, then we have sufficient capacity.
if (__nb == 0)
@@ -2354,7 +2354,7 @@ deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
size_type __nb = __recommend_blocks(__n + __base::__map_.empty());
// Number of unused blocks at front:
size_type __front_capacity = __front_spare() / __base::__block_size;
__front_capacity = _STD::min(__front_capacity, __nb); // don't take more than you need
__front_capacity = min(__front_capacity, __nb); // don't take more than you need
__nb -= __front_capacity; // number of blocks need to allocate
// If __nb == 0, then we have sufficient capacity.
if (__nb == 0)
@@ -2536,7 +2536,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
allocator_type& __a = __base::__alloc();
// as if
// for (; __f != __l; ++__r, ++__f, ++__base::size())
// __alloc_traits::construct(__a, _STD::addressof(*__r), _STD::move(*__f));
// __alloc_traits::construct(__a, addressof(*__r), _STD::move(*__f));
difference_type __n = __l - __f;
while (__n > 0)
{
@@ -2551,7 +2551,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
if (__fb <= __vt && __vt < __fe)
__vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__r), _STD::move(*__fb));
__alloc_traits::construct(__a, addressof(*__r), _STD::move(*__fb));
__n -= __bs;
__f += __bs;
}
@@ -2568,7 +2568,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
// as if
// for (iterator __j = __l; __j != __f;)
// {
// __alloc_traitsconstruct(__a, _STD::addressof(*--__r), _STD::move(*--__j));
// __alloc_traitsconstruct(__a, addressof(*--__r), _STD::move(*--__j));
// --__base::__start_;
// ++__base::size();
// }
@@ -2588,7 +2588,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
__vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
while (__le != __lb)
{
__alloc_traits::construct(__a, _STD::addressof(*--__r), _STD::move(*--__le));
__alloc_traits::construct(__a, addressof(*--__r), _STD::move(*--__le));
--__base::__start_;
++__base::size();
}
@@ -2608,8 +2608,8 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
allocator_type& __a = __base::__alloc();
if (__pos < (__base::size() - 1) / 2)
{ // erase from front
_STD::move_backward(__b, __p, _STD::next(__p));
__alloc_traits::destroy(__a, _STD::addressof(*__b));
_STD::move_backward(__b, __p, next(__p));
__alloc_traits::destroy(__a, addressof(*__b));
--__base::size();
++__base::__start_;
if (__front_spare() >= 2 * __base::__block_size)
@@ -2622,7 +2622,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
else
{ // erase from back
iterator __i = _STD::move(next(__p), __base::end(), __p);
__alloc_traits::destroy(__a, _STD::addressof(*__i));
__alloc_traits::destroy(__a, addressof(*__i));
--__base::size();
if (__back_spare() >= 2 * __base::__block_size)
{
@@ -2648,7 +2648,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
{ // erase from front
iterator __i = _STD::move_backward(__b, __p, __p + __n);
for (; __b != __i; ++__b)
__alloc_traits::destroy(__a, _STD::addressof(*__b));
__alloc_traits::destroy(__a, addressof(*__b));
__base::size() -= __n;
__base::__start_ += __n;
while (__front_spare() >= 2 * __base::__block_size)
@@ -2662,7 +2662,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
{ // erase from back
iterator __i = _STD::move(__p + __n, __base::end(), __p);
for (iterator __e = __base::end(); __i != __e; ++__i)
__alloc_traits::destroy(__a, _STD::addressof(*__i));
__alloc_traits::destroy(__a, addressof(*__i));
__base::size() -= __n;
while (__back_spare() >= 2 * __base::__block_size)
{
@@ -2686,7 +2686,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
iterator __b = __base::begin();
difference_type __pos = __f - __b;
for (iterator __p = __b + __pos; __p != __e; ++__p)
__alloc_traits::destroy(__a, _STD::addressof(*__p));
__alloc_traits::destroy(__a, addressof(*__p));
__base::size() -= __n;
while (__back_spare() >= 2 * __base::__block_size)
{

View File

@@ -341,9 +341,9 @@ public:
void operator()(pointer __p)
{
if (__second_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -666,9 +666,9 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__node_traits::construct(__na, addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _STD::move(__h);
}

View File

@@ -106,21 +106,15 @@ public:
void resize(size_type n, const value_type& v);
void clear();
void splice_after(const_iterator p, forward_list& x);
void splice_after(const_iterator p, forward_list&& x);
void splice_after(const_iterator p, forward_list& x, const_iterator i);
void splice_after(const_iterator p, forward_list&& x, const_iterator i);
void splice_after(const_iterator p, forward_list& x,
const_iterator first, const_iterator last);
void splice_after(const_iterator p, forward_list&& x,
const_iterator first, const_iterator last);
void remove(const value_type& v);
template <class Predicate> void remove_if(Predicate pred);
void unique();
template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);
void merge(forward_list& x);
void merge(forward_list&& x);
template <class Compare> void merge(forward_list& x, Compare comp);
template <class Compare> void merge(forward_list&& x, Compare comp);
void sort();
template <class Compare> void sort(Compare comp);
@@ -492,7 +486,7 @@ __forward_list_base<_Tp, _Alloc>::clear()
for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
{
__node_pointer __next = __p->__next_;
__node_traits::destroy(__a, _STD::addressof(__p->__value_));
__node_traits::destroy(__a, addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1);
__p = __next;
}
@@ -638,18 +632,16 @@ public:
void clear() {base::clear();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void splice_after(const_iterator __p, forward_list&& __x);
_LIBCPP_INLINE_VISIBILITY
void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
_LIBCPP_INLINE_VISIBILITY
void splice_after(const_iterator __p, forward_list&& __x,
const_iterator __f, const_iterator __l);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void splice_after(const_iterator __p, forward_list& __x);
void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
void splice_after(const_iterator __p, forward_list& __x,
const_iterator __f, const_iterator __l);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void remove(const value_type& __v);
template <class _Predicate> void remove_if(_Predicate __pred);
_LIBCPP_INLINE_VISIBILITY
@@ -657,15 +649,13 @@ public:
template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
template <class _Compare>
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x, _Compare __comp)
{merge(__x, _STD::move(__comp));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void merge(forward_list&& __x) {merge(_STD::move(__x), __less<value_type>());}
template <class _Compare> void merge(forward_list&& __x, _Compare __comp);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list& __x) {merge(__x, __less<value_type>());}
template <class _Compare> void merge(forward_list& __x, _Compare __comp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void sort() {sort(__less<value_type>());}
template <class _Compare> void sort(_Compare __comp);
@@ -712,7 +702,7 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
__p = __p->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_));
__node_traits::construct(__a, addressof(__h->__value_));
__h->__next_ = nullptr;
__p->__next_ = __h.release();
}
@@ -871,7 +861,7 @@ typename enable_if
forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
{
iterator __i = before_begin();
iterator __j = _STD::next(__i);
iterator __j = next(__i);
iterator __e = end();
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
*__j = *__f;
@@ -886,7 +876,7 @@ void
forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
{
iterator __i = before_begin();
iterator __j = _STD::next(__i);
iterator __j = next(__i);
iterator __e = end();
for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
*__j = __v;
@@ -915,7 +905,7 @@ forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_),
__node_traits::construct(__a, addressof(__h->__value_),
_STD::forward<_Args>(__args)...);
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
@@ -930,7 +920,7 @@ forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v));
__node_traits::construct(__a, addressof(__h->__value_), _STD::move(__v));
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
}
@@ -944,7 +934,7 @@ forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, addressof(__h->__value_), __v);
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
}
@@ -956,7 +946,7 @@ forward_list<_Tp, _Alloc>::pop_front()
__node_allocator& __a = base::__alloc();
__node_pointer __p = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __p->__next_;
__node_traits::destroy(__a, _STD::addressof(__p->__value_));
__node_traits::destroy(__a, addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1);
}
@@ -972,7 +962,7 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_),
__node_traits::construct(__a, addressof(__h->__value_),
_STD::forward<_Args>(__args)...);
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
@@ -989,7 +979,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v));
__node_traits::construct(__a, addressof(__h->__value_), _STD::move(__v));
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
return iterator(__r->__next_);
@@ -1005,7 +995,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, addressof(__h->__value_), __v);
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
return iterator(__r->__next_);
@@ -1022,7 +1012,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, addressof(__h->__value_), __v);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1032,7 +1022,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
for (--__n; __n != 0; --__n, __last = __last->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, addressof(__h->__value_), __v);
__last->__next_ = __h.release();
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1042,7 +1032,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
while (__first != nullptr)
{
__node_pointer __next = __first->__next_;
__node_traits::destroy(__a, _STD::addressof(__first->__value_));
__node_traits::destroy(__a, addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1);
__first = __next;
}
@@ -1072,7 +1062,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), *__f);
__node_traits::construct(__a, addressof(__h->__value_), *__f);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1082,7 +1072,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
for (++__f; __f != __l; ++__f, __last = __last->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), *__f);
__node_traits::construct(__a, addressof(__h->__value_), *__f);
__last->__next_ = __h.release();
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1092,7 +1082,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
while (__first != nullptr)
{
__node_pointer __next = __first->__next_;
__node_traits::destroy(__a, _STD::addressof(__first->__value_));
__node_traits::destroy(__a, addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1);
__first = __next;
}
@@ -1114,7 +1104,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
__node_pointer __n = __p->__next_;
__p->__next_ = __n->__next_;
__node_allocator& __a = base::__alloc();
__node_traits::destroy(__a, _STD::addressof(__n->__value_));
__node_traits::destroy(__a, addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1);
return iterator(__p->__next_);
}
@@ -1135,7 +1125,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
do
{
__p = __n->__next_;
__node_traits::destroy(__a, _STD::addressof(__n->__value_));
__node_traits::destroy(__a, addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1);
__n = __p;
} while (__n != __e);
@@ -1168,7 +1158,7 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
__ptr = __ptr->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_));
__node_traits::construct(__a, addressof(__h->__value_));
__h->__next_ = nullptr;
__ptr->__next_ = __h.release();
}
@@ -1200,7 +1190,7 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
__ptr = __ptr->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, addressof(__h->__value_), __v);
__h->__next_ = nullptr;
__ptr->__next_ = __h.release();
}
@@ -1211,7 +1201,11 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
forward_list&& __x)
#else
forward_list& __x)
#endif
{
if (!__x.empty())
{
@@ -1232,10 +1226,14 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
forward_list&& __x,
#else
forward_list& __x,
#endif
const_iterator __i)
{
const_iterator __lm1 = _STD::next(__i);
const_iterator __lm1 = next(__i);
if (__p != __i && __p != __lm1)
{
const_cast<__node_pointer>(__i.__ptr_)->__next_ =
@@ -1250,7 +1248,11 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
forward_list&& __x,
#else
forward_list& __x,
#endif
const_iterator __f, const_iterator __l)
{
if (__f != __l && __p != __f)
@@ -1270,39 +1272,6 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
}
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list&& __x)
{
splice_after(__p, __x);
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list&& __x,
const_iterator __i)
{
splice_after(__p, __x, __i);
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list&& __x,
const_iterator __f, const_iterator __l)
{
splice_after(__p, __x, __f, __l);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::remove(const value_type& __v)
@@ -1312,7 +1281,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
{
if (__i.__ptr_->__next_->__value_ == __v)
{
iterator __j = _STD::next(__i, 2);
iterator __j = next(__i, 2);
for (; __j != __e && *__j == __v; ++__j)
;
erase_after(__i, __j);
@@ -1335,7 +1304,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
{
if (__pred(__i.__ptr_->__next_->__value_))
{
iterator __j = _STD::next(__i, 2);
iterator __j = next(__i, 2);
for (; __j != __e && __pred(*__j); ++__j)
;
erase_after(__i, __j);
@@ -1355,7 +1324,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
{
for (iterator __i = begin(), __e = end(); __i != __e;)
{
iterator __j = _STD::next(__i);
iterator __j = next(__i);
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
;
if (__i.__ptr_->__next_ != __j.__ptr_)
@@ -1367,7 +1336,11 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
template <class _Tp, class _Alloc>
template <class _Compare>
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
forward_list<_Tp, _Alloc>::merge(forward_list&& __x, _Compare __comp)
#else
forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp)
#endif
{
if (this != &__x)
{
@@ -1456,7 +1429,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
}
difference_type __sz1 = __sz / 2;
difference_type __sz2 = __sz - __sz1;
__node_pointer __t = _STD::next(iterator(__f1), __sz1 - 1).__ptr_;
__node_pointer __t = next(iterator(__f1), __sz1 - 1).__ptr_;
__node_pointer __f2 = __t->__next_;
__t->__next_ = nullptr;
return __merge(__sort(__f1, __sz1, __comp),

View File

@@ -579,7 +579,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
this->setg(this->eback(),
this->eback() + __unget_sz,
this->eback() + __unget_sz + __nmemb);
__c = traits_type::to_int_type(*this->gptr());
__c = *this->gptr();
}
}
else
@@ -587,7 +587,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
size_t __nmemb = _STD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
size_t __nmemb = min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
static_cast<size_t>(__extbufend_ - __extbufnext_));
codecvt_base::result __r;
state_type __svs = __st_;
@@ -602,18 +602,18 @@ basic_filebuf<_CharT, _Traits>::underflow()
if (__r == codecvt_base::noconv)
{
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
__c = traits_type::to_int_type(*this->gptr());
__c = *this->gptr();
}
else if (__inext != this->eback() + __unget_sz)
{
this->setg(this->eback(), this->eback() + __unget_sz, __inext);
__c = traits_type::to_int_type(*this->gptr());
__c = *this->gptr();
}
}
}
}
else
__c = traits_type::to_int_type(*this->gptr());
__c = *this->gptr();
if (this->eback() == &__1buf)
this->setg(0, 0, 0);
return __c;

View File

@@ -1559,7 +1559,10 @@ typename enable_if
__mu(_Ti&, _Uj& __uj)
{
const size_t _Indx = is_placeholder<_Ti>::value - 1;
return _STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj));
// compiler bug workaround
typename tuple_element<_Indx, _Uj>::type __t = get<_Indx>(__uj);
return __t;
// return _STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj));
}
template <class _Ti, class _Uj>

View File

@@ -272,16 +272,16 @@ public:
class Init;
// 27.5.2.2 fmtflags state:
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
_LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
_LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
fmtflags flags() const;
fmtflags flags(fmtflags __fmtfl);
fmtflags setf(fmtflags __fmtfl);
fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
void unsetf(fmtflags __mask);
_LIBCPP_INLINE_VISIBILITY streamsize precision() const;
_LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
_LIBCPP_INLINE_VISIBILITY streamsize width() const;
_LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
streamsize precision() const;
streamsize precision(streamsize __prec);
streamsize width() const;
streamsize width(streamsize __wide);
// 27.5.2.3 locales:
locale imbue(const locale& __loc);
@@ -307,17 +307,17 @@ private:
public:
static bool sync_with_stdio(bool __sync = true);
_LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
iostate rdstate() const;
void clear(iostate __state = goodbit);
_LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
void setstate(iostate __state);
_LIBCPP_INLINE_VISIBILITY bool good() const;
_LIBCPP_INLINE_VISIBILITY bool eof() const;
_LIBCPP_INLINE_VISIBILITY bool fail() const;
_LIBCPP_INLINE_VISIBILITY bool bad() const;
bool good() const;
bool eof() const;
bool fail() const;
bool bad() const;
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except);
iostate exceptions() const;
void exceptions(iostate __except);
void __set_badbit_and_consider_rethrow();
void __set_failbit_and_consider_rethrow();
@@ -587,52 +587,38 @@ public:
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
// 27.5.4.1 Constructor/destructor:
_LIBCPP_INLINE_VISIBILITY
explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
virtual ~basic_ios();
// 27.5.4.2 Members:
_LIBCPP_INLINE_VISIBILITY
basic_ostream<char_type, traits_type>* tie() const;
_LIBCPP_INLINE_VISIBILITY
basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
_LIBCPP_INLINE_VISIBILITY
basic_streambuf<char_type, traits_type>* rdbuf() const;
_LIBCPP_INLINE_VISIBILITY
basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
basic_ios& copyfmt(const basic_ios& __rhs);
_LIBCPP_INLINE_VISIBILITY
char_type fill() const;
_LIBCPP_INLINE_VISIBILITY
char_type fill(char_type __ch);
_LIBCPP_INLINE_VISIBILITY
locale imbue(const locale& __loc);
_LIBCPP_INLINE_VISIBILITY
char narrow(char_type __c, char __dfault) const;
_LIBCPP_INLINE_VISIBILITY
char_type widen(char __c) const;
protected:
_LIBCPP_ALWAYS_INLINE
basic_ios() {// purposefully does no initialization
}
_LIBCPP_INLINE_VISIBILITY
void init(basic_streambuf<char_type, traits_type>* __sb);
_LIBCPP_INLINE_VISIBILITY
void move(basic_ios& __rhs);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_ALWAYS_INLINE
void move(basic_ios&& __rhs) {move(__rhs);}
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(basic_ios& __rhs);
_LIBCPP_INLINE_VISIBILITY
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
private:
basic_ostream<char_type, traits_type>* __tie_;

View File

@@ -92,8 +92,6 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
_LIBCPP_BEGIN_NAMESPACE_STD
class ios_base;
template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
template<class _Tp> class _LIBCPP_VISIBLE allocator;

View File

@@ -801,13 +801,6 @@ 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;
@@ -819,7 +812,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
}
else
__is.setstate(ios_base::eofbit | ios_base::failbit);
#endif
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1273,7 +1265,7 @@ basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
case 0:
break;
default:
__c = _STD::min(__c, __n);
__c = min(__c, __n);
for (streamsize __k = 0; __k < __c; ++__k, ++__s, ++__i)
*__s = *__i;
}

View File

@@ -488,7 +488,7 @@ next(_ForwardIter __x,
typename iterator_traits<_ForwardIter>::difference_type __n = 1,
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
{
_STD::advance(__x, __n);
advance(__x, __n);
return __x;
}
@@ -499,7 +499,7 @@ prev(_BidiretionalIter __x,
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
{
_STD::advance(__x, -__n);
advance(__x, -__n);
return __x;
}
@@ -902,13 +902,8 @@ public:
template <class _Up> _LIBCPP_INLINE_VISIBILITY move_iterator(const move_iterator<_Up>& __u)
: __i(__u.base()) {}
_LIBCPP_INLINE_VISIBILITY _Iter base() const {return __i;}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {
return static_cast<reference>(*__i);
}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {
typename iterator_traits<iterator_type>::reference __ref = *__i;
return &__ref;
}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__i;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;}
_LIBCPP_INLINE_VISIBILITY move_iterator operator++(int)
{move_iterator __tmp(*this); ++__i; return __tmp;}
@@ -924,9 +919,7 @@ public:
_LIBCPP_INLINE_VISIBILITY move_iterator& operator-=(difference_type __n)
{__i -= __n; return *this;}
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
{
return static_cast<reference>(__i[__n]);
}
{return __i[__n];}
};
template <class _Iter1, class _Iter2>

View File

@@ -236,8 +236,6 @@ public:
pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
__list_iterator() {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
@@ -291,8 +289,6 @@ public:
pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator(__list_iterator<_Tp, _VoidPtr> __p) : __ptr_(__p.__ptr_) {}
@@ -473,8 +469,8 @@ __list_imp<_Tp, _Alloc>::clear()
{
__node& __n = *__f.__ptr_;
++__f;
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
}
}
}
@@ -714,8 +710,8 @@ inline _LIBCPP_INLINE_VISIBILITY
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::__iterator(size_type __n)
{
return __n <= base::__sz() / 2 ? _STD::next(begin(), __n)
: _STD::prev(end(), base::__sz() - __n);
return __n <= base::__sz() / 2 ? next(begin(), __n)
: prev(end(), base::__sz() - __n);
}
template <class _Tp, class _Alloc>
@@ -915,7 +911,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
return iterator(__hold.release());
@@ -933,7 +929,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
++__ds;
__r = iterator(__hold.get());
__hold.release();
@@ -945,7 +941,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
for (--__n; __n != 0; --__n, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -956,7 +952,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
{
while (true)
{
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -986,7 +982,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), *__f);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), *__f);
++__ds;
__r = iterator(__hold.get());
__hold.release();
@@ -998,7 +994,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
for (++__f; __f != __l; ++__f, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), *__f);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), *__f);
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -1009,7 +1005,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
{
while (true)
{
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -1032,7 +1028,7 @@ list<_Tp, _Alloc>::push_front(const value_type& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1045,7 +1041,7 @@ list<_Tp, _Alloc>::push_back(const value_type& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1060,7 +1056,7 @@ list<_Tp, _Alloc>::push_front(value_type&& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::move(__x));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1073,7 +1069,7 @@ list<_Tp, _Alloc>::push_back(value_type&& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::move(__x));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1089,7 +1085,7 @@ list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1103,7 +1099,7 @@ list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1118,7 +1114,7 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
return iterator(__hold.release());
@@ -1134,7 +1130,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::move(__x));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
return iterator(__hold.release());
@@ -1150,8 +1146,8 @@ list<_Tp, _Alloc>::pop_front()
__node& __n = *base::__end_.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
}
template <class _Tp, class _Alloc>
@@ -1162,8 +1158,8 @@ list<_Tp, _Alloc>::pop_back()
__node& __n = *base::__end_.__prev_;
base::__unlink_nodes(__n, __n);
--base::__sz();
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
}
template <class _Tp, class _Alloc>
@@ -1175,8 +1171,8 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
__node_pointer __r = __n.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
return iterator(__r);
}
@@ -1193,8 +1189,8 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
__node& __n = const_cast<__node&>(*__f.__ptr_);
++__f;
--base::__sz();
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
}
}
return iterator(const_cast<__node_pointer>(__l.__ptr_));
@@ -1214,7 +1210,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_));
__node_alloc_traits::construct(__na, addressof(__hold->__value_));
++__ds;
iterator __r = iterator(__hold.release());
iterator __e = __r;
@@ -1225,7 +1221,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
for (--__n; __n != 0; --__n, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_));
__node_alloc_traits::construct(__na, addressof(__hold->__value_));
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -1236,7 +1232,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
{
while (true)
{
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -1265,7 +1261,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
++__ds;
iterator __r = iterator(__hold.release());
iterator __e = __r;
@@ -1276,7 +1272,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
for (--__n; __n != 0; --__n, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -1287,7 +1283,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
{
while (true)
{
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -1321,7 +1317,7 @@ template <class _Tp, class _Alloc>
void
list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
{
if (__p != __i && __p != _STD::next(__i))
if (__p != __i && __p != next(__i))
{
__node& __f = const_cast<__node&>(*__i.__ptr_);
base::__unlink_nodes(__f, __f);
@@ -1359,7 +1355,7 @@ list<_Tp, _Alloc>::remove(const value_type& __x)
{
if (*__i == __x)
{
iterator __j = _STD::next(__i);
iterator __j = next(__i);
for (; __j != __e && *__j == __x; ++__j)
;
__i = erase(__i, __j);
@@ -1378,7 +1374,7 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
{
if (__pred(*__i))
{
iterator __j = _STD::next(__i);
iterator __j = next(__i);
for (; __j != __e && __pred(*__j); ++__j)
;
__i = erase(__i, __j);
@@ -1403,7 +1399,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
{
for (iterator __i = begin(), __e = end(); __i != __e;)
{
iterator __j = _STD::next(__i);
iterator __j = next(__i);
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
;
if (++__i != __j)
@@ -1435,7 +1431,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
if (__comp(*__f2, *__f1))
{
size_type __ds = 1;
iterator __m2 = _STD::next(__f2);
iterator __m2 = next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, ++__ds)
;
base::__sz() += __ds;
@@ -1444,7 +1440,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
__node& __l = *__m2.__ptr_->__prev_;
__f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = _STD::next(__f1);
__m2 = next(__f1);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
@@ -1493,12 +1489,12 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
return __f1;
}
size_type __n2 = __n / 2;
iterator __e1 = _STD::next(__f1, __n2);
iterator __e1 = next(__f1, __n2);
iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp);
iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
if (__comp(*__f2, *__f1))
{
iterator __m2 = _STD::next(__f2);
iterator __m2 = next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
;
__node& __f = *__f2.__ptr_;
@@ -1506,7 +1502,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
__r = __f2;
__e1 = __f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = _STD::next(__f1);
__m2 = next(__f1);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
@@ -1516,7 +1512,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
{
if (__comp(*__f2, *__f1))
{
iterator __m2 = _STD::next(__f2);
iterator __m2 = next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
;
__node& __f = *__f2.__ptr_;
@@ -1525,7 +1521,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
__e1 = __m2;
__f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = _STD::next(__f1);
__m2 = next(__f1);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}

View File

@@ -265,10 +265,7 @@ __nolocale_isdigit(int __c)
}
#else // __APPLE__
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, ...)
@@ -279,10 +276,7 @@ __nolocale_sprintf(char* __restrict __str,
va_end(__ap);
return __result;
}
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, ...)
@@ -293,10 +287,7 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
va_end(__ap);
return __result;
}
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret,
const char* __restrict __format, ...)
@@ -307,10 +298,7 @@ __nolocale_asprintf(char** __ret,
va_end(__ap);
return __result;
}
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, ...)
@@ -522,12 +510,6 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
unsigned* __g, unsigned*& __g_end, _CharT* __atoms)
{
if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
{
*__a_end++ = __ct == __atoms[24] ? '+' : '-';
__dc = 0;
return 0;
}
if (__ct == __thousands_sep && __grouping.size() != 0)
{
if (__g_end-__g < __num_get_buf_sz)
@@ -538,28 +520,22 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
return 0;
}
ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms;
if (__f >= 24)
if (__f >= 26)
return -1;
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __src[__f];
switch (__base)
{
case 8:
case 10:
if (__f >= __base)
return -1;
break;
case 16:
if (__f < 22)
break;
if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
{
__dc = 0;
*__a_end++ = __src[__f];
return 0;
}
return -1;
break;
default:
if (__f >= 22)
return 0;
break;
}
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __src[__f];
++__dc;
return 0;
}
@@ -745,27 +721,22 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
{
if (__a != __a_end)
{
int __save_errno = errno;
errno = 0;
char *__p2;
long long __ll = strtoll_l(__a, &__p2, __base, 0);
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
if (__p2 != __a_end)
{
__err = ios_base::failbit;
return 0;
}
else if (__current_errno == ERANGE ||
__ll < numeric_limits<_Tp>::min() ||
numeric_limits<_Tp>::max() < __ll)
else if (__ll > numeric_limits<_Tp>::max())
{
__err = ios_base::failbit;
if (__ll > 0)
return numeric_limits<_Tp>::max();
else
return numeric_limits<_Tp>::min();
return numeric_limits<_Tp>::max();
}
else if (__ll < numeric_limits<_Tp>::min())
{
__err = ios_base::failbit;
return numeric_limits<_Tp>::min();
}
return static_cast<_Tp>(__ll);
}
@@ -780,25 +751,14 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
{
if (__a != __a_end)
{
if (*__a == '-')
{
__err = ios_base::failbit;
return 0;
}
int __save_errno = errno;
errno = 0;
char *__p2;
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
if (__p2 != __a_end)
{
__err = ios_base::failbit;
return 0;
}
else if (__current_errno == ERANGE ||
numeric_limits<_Tp>::max() < __ll)
else if (__ll > numeric_limits<_Tp>::max())
{
__err = ios_base::failbit;
return numeric_limits<_Tp>::max();
@@ -1796,7 +1756,7 @@ public:
};
template <class _CharT>
class __time_get_c_storage // purposefully not decorated
class __time_get_c_storage
{
protected:
typedef basic_string<_CharT> string_type;
@@ -2608,7 +2568,7 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char_type* __nb = __nar;
char_type* __ne = __nb + 100;
__do_put(__nb, __ne, __tm, __fmt, __mod);
return _STD::copy(__nb, __ne, __s);
return copy(__nb, __ne, __s);
}
extern template class time_put<char>;
@@ -2678,15 +2638,24 @@ protected:
_LIBCPP_ALWAYS_INLINE
~moneypunct() {}
_LIBCPP_ALWAYS_INLINE
virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();}
_LIBCPP_ALWAYS_INLINE
virtual char_type do_thousands_sep() const {return numeric_limits<char_type>::max();}
_LIBCPP_ALWAYS_INLINE
virtual string do_grouping() const {return string();}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_curr_symbol() const {return string_type();}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_positive_sign() const {return string_type();}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_negative_sign() const {return string_type(1, '-');}
_LIBCPP_ALWAYS_INLINE
virtual int do_frac_digits() const {return 0;}
_LIBCPP_ALWAYS_INLINE
virtual pattern do_pos_format() const
{pattern __p = {symbol, sign, none, value}; return __p;}
_LIBCPP_ALWAYS_INLINE
virtual pattern do_neg_format() const
{pattern __p = {symbol, sign, none, value}; return __p;}
};
@@ -2723,14 +2692,23 @@ protected:
_LIBCPP_ALWAYS_INLINE
~moneypunct_byname() {}
_LIBCPP_ALWAYS_INLINE
virtual char_type do_decimal_point() const {return __decimal_point_;}
_LIBCPP_ALWAYS_INLINE
virtual char_type do_thousands_sep() const {return __thousands_sep_;}
_LIBCPP_ALWAYS_INLINE
virtual string do_grouping() const {return __grouping_;}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_curr_symbol() const {return __curr_symbol_;}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_positive_sign() const {return __positive_sign_;}
_LIBCPP_ALWAYS_INLINE
virtual string_type do_negative_sign() const {return __negative_sign_;}
_LIBCPP_ALWAYS_INLINE
virtual int do_frac_digits() const {return __frac_digits_;}
_LIBCPP_ALWAYS_INLINE
virtual pattern do_pos_format() const {return __pos_format_;}
_LIBCPP_ALWAYS_INLINE
virtual pattern do_neg_format() const {return __neg_format_;}
private:
@@ -3276,7 +3254,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
break;
case money_base::symbol:
if (!__sym.empty() && (__flags & ios_base::showbase))
__me = _STD::copy(__sym.begin(), __sym.end(), __me);
__me = copy(__sym.begin(), __sym.end(), __me);
break;
case money_base::value:
{
@@ -3335,7 +3313,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
}
// print rest of sign, if any
if (__sn.size() > 1)
__me = _STD::copy(__sn.begin()+1, __sn.end(), __me);
__me = copy(__sn.begin()+1, __sn.end(), __me);
// set alignment
if ((__flags & ios_base::adjustfield) == ios_base::left)
__mi = __me;
@@ -3502,7 +3480,7 @@ extern template class money_put<wchar_t>;
class _LIBCPP_VISIBLE messages_base
{
public:
typedef ptrdiff_t catalog;
typedef nl_catd catalog;
_LIBCPP_ALWAYS_INLINE messages_base() {}
};
@@ -3559,10 +3537,7 @@ template <class _CharT>
typename messages<_CharT>::catalog
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
{
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
if (__cat != -1)
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
return __cat;
return catopen(__nm.c_str(), NL_CAT_LOCALE);
}
template <class _CharT>
@@ -3574,10 +3549,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
__dflt.c_str(),
__dflt.c_str() + __dflt.size());
if (__c != -1)
__c <<= 1;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
char* __n = catgets(__c, __set, __msgid, __ndflt.c_str());
string_type __w;
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
__n, __n + strlen(__n));
@@ -3588,10 +3560,7 @@ template <class _CharT>
void
messages<_CharT>::do_close(catalog __c) const
{
if (__c != -1)
__c <<= 1;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
catclose(__cat);
catclose(__c);
}
extern template class messages<char>;
@@ -4004,7 +3973,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
streamsize __nmemb = _STD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
streamsize __nmemb = min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
static_cast<streamsize>(__extbufend_ - __extbufnext_));
codecvt_base::result __r;
state_type __svs = __st_;

View File

@@ -350,7 +350,7 @@ template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::valu
class __map_value_compare
: private _Compare
{
typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
typedef pair<_Key, _Tp> _P;
typedef pair<const _Key, _Tp> _CP;
public:
_LIBCPP_INLINE_VISIBILITY
@@ -393,7 +393,7 @@ class __map_value_compare<_Key, _Tp, _Compare, false>
{
_Compare comp;
typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
typedef pair<_Key, _Tp> _P;
typedef pair<const _Key, _Tp> _CP;
public:
@@ -475,9 +475,9 @@ public:
void operator()(pointer __p)
{
if (__second_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -493,11 +493,11 @@ class _LIBCPP_VISIBLE __map_iterator
_TreeIterator __i_;
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
typedef const typename _TreeIterator::value_type::first_type __key_type;
typedef typename _TreeIterator::value_type::second_type __mapped_type;
typedef const typename _TreeIterator::value_type::first_type key_type;
typedef typename _TreeIterator::value_type::second_type mapped_type;
public:
typedef bidirectional_iterator_tag iterator_category;
typedef pair<__key_type, __mapped_type> value_type;
typedef pair<key_type, mapped_type> value_type;
typedef typename _TreeIterator::difference_type difference_type;
typedef value_type& reference;
typedef typename __pointer_traits::template
@@ -558,11 +558,11 @@ class _LIBCPP_VISIBLE __map_const_iterator
_TreeIterator __i_;
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
typedef const typename _TreeIterator::value_type::first_type __key_type;
typedef typename _TreeIterator::value_type::second_type __mapped_type;
typedef const typename _TreeIterator::value_type::first_type key_type;
typedef typename _TreeIterator::value_type::second_type mapped_type;
public:
typedef bidirectional_iterator_tag iterator_category;
typedef pair<__key_type, __mapped_type> value_type;
typedef pair<key_type, mapped_type> value_type;
typedef typename _TreeIterator::difference_type difference_type;
typedef const value_type& reference;
typedef typename __pointer_traits::template
@@ -1042,7 +1042,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(const_iterator __hint,
else if (__tree_.value_comp().key_comp()(__hint->first, __k)) // check after
{
// *__hint < __k
const_iterator __next = _STD::next(__hint);
const_iterator __next = next(__hint);
if (__next == end() || __tree_.value_comp().key_comp()(__k, __next->first))
{
// *__hint < __k < *next(__hint)
@@ -1131,9 +1131,9 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first));
__node_traits::construct(__na, addressof(__h->__value_.first));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__node_traits::construct(__na, addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1146,7 +1146,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_A0>(__a0));
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
return __h;
@@ -1162,9 +1162,9 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
__node_traits::construct(__na, addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
__node_traits::construct(__na, addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1179,9 +1179,9 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(const key_type& __k)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__node_traits::construct(__na, addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _STD::move(__h);
}
@@ -1685,9 +1685,9 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first));
__node_traits::construct(__na, addressof(__h->__value_.first));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__node_traits::construct(__na, addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1701,7 +1701,7 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_A0>(__a0));
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
return __h;
@@ -1718,9 +1718,9 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&&
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
__node_traits::construct(__na, addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
__node_traits::construct(__na, addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}

View File

@@ -1487,7 +1487,7 @@ struct _LIBCPP_VISIBLE uses_allocator
{
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
// uses-allocator construction
@@ -1505,7 +1505,7 @@ struct __uses_alloc_ctor
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
{};
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
// allocator
@@ -1525,8 +1525,8 @@ public:
_LIBCPP_INLINE_VISIBILITY allocator() throw() {}
template <class _Up> _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) throw() {}
_LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const {return _STD::addressof(__x);}
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const {return _STD::addressof(__x);}
_LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const {return addressof(__x);}
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const {return addressof(__x);}
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
{return static_cast<pointer>(::operator new(__n * sizeof(_Tp)));}
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) {::operator delete((void*)__p);}
@@ -1546,7 +1546,6 @@ public:
{
::new((void*)__p) _Tp();
}
# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
@@ -1580,7 +1579,6 @@ public:
{
::new((void*)__p) _Tp(_STD::move(__a0));
}
# endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
void

View File

@@ -364,9 +364,9 @@ lock(_L0& __l0, _L1& __l1)
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _L0, class _L1, class _L2, class ..._L3>
template <class _L0, class _L1, class ..._L2>
void
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
{
while (true)
{
@@ -375,7 +375,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
case 0:
{
unique_lock<_L0> __u0(__l0);
__i = try_lock(__l1, __l2, __l3...);
__i = try_lock(__l1, __l2...);
if (__i == -1)
{
__u0.release();
@@ -388,32 +388,32 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
case 1:
{
unique_lock<_L1> __u1(__l1);
__i = try_lock(__l2, __l3..., __l0);
__i = try_lock(__l2..., __l0);
if (__i == -1)
{
__u1.release();
return;
}
}
if (__i == sizeof...(_L3) + 1)
if (__i == sizeof...(_L2))
__i = 0;
else
__i += 2;
sched_yield();
break;
default:
__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
__lock_first(__i - 2, __l2..., __l0, __l1);
return;
}
}
}
template <class _L0, class _L1, class _L2, class ..._L3>
template <class _L0, class _L1, class ..._L2>
inline _LIBCPP_INLINE_VISIBILITY
void
lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
lock(_L0& __l0, _L1& __l1, _L2& ...__l2)
{
__lock_first(0, __l0, __l1, __l2, __l3...);
__lock_first(0, __l0, __l1, __l2...);
}
#endif // _LIBCPP_HAS_NO_VARIADICS

View File

@@ -1276,7 +1276,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
template <class _CharT, class _Traits, size_t _Size>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
operator<<(basic_ostream<_CharT, _Traits>& __os, bitset<_Size>& __x)
{
return __os << __x.template to_string<_CharT, _Traits>
(use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),

View File

@@ -208,8 +208,6 @@ public:
bool matched;
constexpr sub_match();
difference_type length() const;
operator string_type() const;
string_type str() const;
@@ -454,8 +452,6 @@ public:
match_results& operator=(match_results&& m);
~match_results();
bool ready() const;
// size:
size_type size() const;
size_type max_size() const;
@@ -1264,7 +1260,6 @@ struct __state
vector<pair<size_t, const _CharT*> > __loop_data_;
const __node<_CharT>* __node_;
regex_constants::match_flag_type __flags_;
bool __at_first_;
_LIBCPP_INLINE_VISIBILITY
__state()
@@ -1891,40 +1886,6 @@ __word_boundary<_CharT, _Traits>::__exec(__state& __s) const
}
}
// __l_anchor
template <class _CharT>
class __l_anchor
: public __owns_one_state<_CharT>
{
typedef __owns_one_state<_CharT> base;
public:
typedef _STD::__state<_CharT> __state;
_LIBCPP_INLINE_VISIBILITY
__l_anchor(__node<_CharT>* __s)
: base(__s) {}
virtual void __exec(__state&) const;
};
template <class _CharT>
void
__l_anchor<_CharT>::__exec(__state& __s) const
{
if (__s.__at_first_ && __s.__current_ == __s.__first_)
{
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
}
else
{
__s.__do_ = __state::__reject;
__s.__node_ = nullptr;
}
}
// __r_anchor
template <class _CharT>
@@ -2263,7 +2224,7 @@ __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const
++__consumed;
if (__might_have_digraph_)
{
const _CharT* __next = _STD::next(__s.__current_);
const _CharT* __next = next(__s.__current_);
if (__next != __s.__last_)
{
pair<_CharT, _CharT> __ch2(*__s.__current_, *__next);
@@ -2429,6 +2390,7 @@ private:
int __open_count_;
shared_ptr<__empty_state<_CharT> > __start_;
__owns_one_state<_CharT>* __end_;
bool __left_anchor_;
typedef _STD::__state<_CharT> __state;
typedef _STD::__node<_CharT> __node;
@@ -2450,17 +2412,17 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex()
: __flags_(), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(0), __left_anchor_(false)
{}
_LIBCPP_INLINE_VISIBILITY
explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(0), __left_anchor_(false)
{__parse(__p, __p + __traits_.length(__p));}
_LIBCPP_INLINE_VISIBILITY
basic_regex(const value_type* __p, size_t __len, flag_type __f)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(0), __left_anchor_(false)
{__parse(__p, __p + __len);}
// basic_regex(const basic_regex&) = default;
// basic_regex(basic_regex&&) = default;
@@ -2469,20 +2431,20 @@ public:
explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(0), __left_anchor_(false)
{__parse(__p.begin(), __p.end());}
template <class _ForwardIterator>
_LIBCPP_INLINE_VISIBILITY
basic_regex(_ForwardIterator __first, _ForwardIterator __last,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(0), __left_anchor_(false)
{__parse(__first, __last);}
_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)
__end_(0), __left_anchor_(false)
{__parse(__il.begin(), __il.end());}
// ~basic_regex() = default;
@@ -2540,6 +2502,7 @@ private:
__loop_count_ = 0;
__open_count_ = 0;
__end_ = nullptr;
__left_anchor_ = false;
}
public:
@@ -2727,7 +2690,7 @@ private:
basic_string<_CharT>* __str = nullptr);
_LIBCPP_INLINE_VISIBILITY
void __push_l_anchor();
void __push_l_anchor() {__left_anchor_ = true;}
void __push_r_anchor();
void __push_match_any();
void __push_match_any_but_newline();
@@ -2765,22 +2728,22 @@ private:
bool
__match_at_start(const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool) const;
regex_constants::match_flag_type __flags) const;
template <class _Allocator>
bool
__match_at_start_ecma(const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool) const;
regex_constants::match_flag_type __flags) const;
template <class _Allocator>
bool
__match_at_start_posix_nosubs(const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool) const;
regex_constants::match_flag_type __flags) const;
template <class _Allocator>
bool
__match_at_start_posix_subs(const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool) const;
regex_constants::match_flag_type __flags) const;
template <class _B, class _A, class _C, class _T>
friend
@@ -2842,6 +2805,7 @@ basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
swap(__open_count_, __r.__open_count_);
swap(__start_, __r.__start_);
swap(__end_, __r.__end_);
swap(__left_anchor_, __r.__left_anchor_);
}
template <class _CharT, class _Traits>
@@ -2882,9 +2846,7 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const
match_results<const _CharT*> __m;
__m.__init(1 + __exp_.mark_count(), __s.__current_, __s.__last_);
bool __matched = __exp_.__match_at_start_ecma(__s.__current_, __s.__last_,
__m,
__s.__flags_ | regex_constants::match_continuous,
true);
__m, __s.__flags_);
if (__matched != __invert_)
{
__s.__do_ = __state::__accept_but_not_consume;
@@ -2953,7 +2915,7 @@ basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first,
__first = __parse_RE_expression(__first, __last);
if (__first != __last)
{
_ForwardIterator __temp = _STD::next(__first);
_ForwardIterator __temp = next(__first);
if (__temp == __last && *__first == '$')
{
__push_r_anchor();
@@ -3182,7 +3144,7 @@ basic_regex<_CharT, _Traits>::__parse_Back_open_paren(_ForwardIterator __first,
{
if (__first != __last)
{
_ForwardIterator __temp = _STD::next(__first);
_ForwardIterator __temp = next(__first);
if (__temp != __last)
{
if (*__first == '\\' && *__temp == '(')
@@ -3200,7 +3162,7 @@ basic_regex<_CharT, _Traits>::__parse_Back_close_paren(_ForwardIterator __first,
{
if (__first != __last)
{
_ForwardIterator __temp = _STD::next(__first);
_ForwardIterator __temp = next(__first);
if (__temp != __last)
{
if (*__first == '\\' && *__temp == ')')
@@ -3218,7 +3180,7 @@ basic_regex<_CharT, _Traits>::__parse_Back_open_brace(_ForwardIterator __first,
{
if (__first != __last)
{
_ForwardIterator __temp = _STD::next(__first);
_ForwardIterator __temp = next(__first);
if (__temp != __last)
{
if (*__first == '\\' && *__temp == '{')
@@ -3236,7 +3198,7 @@ basic_regex<_CharT, _Traits>::__parse_Back_close_brace(_ForwardIterator __first,
{
if (__first != __last)
{
_ForwardIterator __temp = _STD::next(__first);
_ForwardIterator __temp = next(__first);
if (__temp != __last)
{
if (*__first == '\\' && *__temp == '}')
@@ -3254,7 +3216,7 @@ basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first,
{
if (__first != __last)
{
_ForwardIterator __temp = _STD::next(__first);
_ForwardIterator __temp = next(__first);
if (__temp != __last)
{
if (*__first == '\\' && '1' <= *__temp && *__temp <= '9')
@@ -3275,7 +3237,7 @@ basic_regex<_CharT, _Traits>::__parse_ORD_CHAR(_ForwardIterator __first,
{
if (__first != __last)
{
_ForwardIterator __temp = _STD::next(__first);
_ForwardIterator __temp = next(__first);
if (__temp == __last && *__first == '$')
return __first;
// Not called inside a bracket
@@ -3333,7 +3295,7 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR(_ForwardIterator __first,
{
if (__first != __last)
{
_ForwardIterator __temp = _STD::next(__first);
_ForwardIterator __temp = next(__first);
if (__temp != __last)
{
if (*__first == '\\')
@@ -3364,7 +3326,7 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,
{
if (__first != __last)
{
_ForwardIterator __temp = _STD::next(__first);
_ForwardIterator __temp = next(__first);
if (__temp != __last)
{
if (*__first == '\\')
@@ -3674,7 +3636,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
{
if (__first != __last && *__first != ']')
{
_ForwardIterator __temp = _STD::next(__first);
_ForwardIterator __temp = next(__first);
basic_string<_CharT> __start_range;
if (__temp != __last && *__first == '[')
{
@@ -3703,7 +3665,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
}
if (__first != __last && *__first != ']')
{
__temp = _STD::next(__first);
__temp = next(__first);
if (__temp != __last && *__first == '-' && *__temp != ']')
{
// parse a range
@@ -3925,7 +3887,7 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
#endif // _LIBCPP_NO_EXCEPTIONS
}
}
__first = _STD::next(__temp, 2);
__first = next(__temp, 2);
return __first;
}
@@ -3954,7 +3916,7 @@ basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first,
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__ml->__add_class(__class_type);
__first = _STD::next(__temp, 2);
__first = next(__temp, 2);
return __first;
}
@@ -3987,7 +3949,7 @@ basic_regex<_CharT, _Traits>::__parse_collating_symbol(_ForwardIterator __first,
throw regex_error(regex_constants::error_collate);
#endif // _LIBCPP_NO_EXCEPTIONS
}
__first = _STD::next(__temp, 2);
__first = next(__temp, 2);
return __first;
}
@@ -4121,6 +4083,7 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
basic_regex __exp;
__exp.__flags_ = __flags_;
__temp = __exp.__parse(++__temp, __last);
__exp.__push_l_anchor();
__push_lookahead(_STD::move(__exp), false);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
@@ -4134,6 +4097,7 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
basic_regex __exp;
__exp.__flags_ = __flags_;
__temp = __exp.__parse(++__temp, __last);
__exp.__push_l_anchor();
__push_lookahead(_STD::move(__exp), true);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
@@ -4608,14 +4572,6 @@ basic_regex<_CharT, _Traits>::__push_end_marked_subexpression(unsigned __sub)
}
}
template <class _CharT, class _Traits>
void
basic_regex<_CharT, _Traits>::__push_l_anchor()
{
__end_->first() = new __l_anchor<_CharT>(__end_->first());
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
void
basic_regex<_CharT, _Traits>::__push_r_anchor()
@@ -4727,9 +4683,6 @@ public:
bool matched;
_LIBCPP_INLINE_VISIBILITY
/*constexpr*/ sub_match() : matched() {}
_LIBCPP_INLINE_VISIBILITY
difference_type length() const
{return matched ? _STD::distance(this->first, this->second) : 0;}
@@ -5151,7 +5104,6 @@ private:
value_type __unmatched_;
value_type __prefix_;
value_type __suffix_;
bool __ready_;
public:
_BidirectionalIterator __position_start_;
typedef const value_type& const_reference;
@@ -5171,9 +5123,6 @@ public:
// match_results& operator=(match_results&& __m) = default;
// ~match_results() = default;
_LIBCPP_INLINE_VISIBILITY
bool ready() const {return __ready_;}
// size:
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __matches_.size();}
@@ -5260,22 +5209,21 @@ public:
__matches_.resize(__m.size());
for (size_type __i = 0; __i < __matches_.size(); ++__i)
{
__matches_[__i].first = _STD::next(__f, _STD::distance(__mf, __m[__i].first));
__matches_[__i].second = _STD::next(__f, _STD::distance(__mf, __m[__i].second));
__matches_[__i].first = next(__f, _STD::distance(__mf, __m[__i].first));
__matches_[__i].second = next(__f, _STD::distance(__mf, __m[__i].second));
__matches_[__i].matched = __m[__i].matched;
}
__unmatched_.first = __l;
__unmatched_.second = __l;
__unmatched_.matched = false;
__prefix_.first = _STD::next(__f, _STD::distance(__mf, __m.prefix().first));
__prefix_.second = _STD::next(__f, _STD::distance(__mf, __m.prefix().second));
__prefix_.first = next(__f, _STD::distance(__mf, __m.prefix().first));
__prefix_.second = next(__f, _STD::distance(__mf, __m.prefix().second));
__prefix_.matched = __m.prefix().matched;
__suffix_.first = _STD::next(__f, _STD::distance(__mf, __m.suffix().first));
__suffix_.second = _STD::next(__f, _STD::distance(__mf, __m.suffix().second));
__suffix_.first = next(__f, _STD::distance(__mf, __m.suffix().first));
__suffix_.second = next(__f, _STD::distance(__mf, __m.suffix().second));
__suffix_.matched = __m.suffix().matched;
if (!__no_update_pos)
__position_start_ = __prefix_.first;
__ready_ = __m.ready();
}
private:
@@ -5306,8 +5254,7 @@ match_results<_BidirectionalIterator, _Allocator>::match_results(
__unmatched_(),
__prefix_(),
__suffix_(),
__position_start_(),
__ready_(false)
__position_start_()
{
}
@@ -5327,7 +5274,6 @@ match_results<_BidirectionalIterator, _Allocator>::__init(unsigned __s,
__suffix_ = __unmatched_;
if (!__no_update_pos)
__position_start_ = __prefix_.first;
__ready_ = true;
}
template <class _BidirectionalIterator, class _Allocator>
@@ -5433,7 +5379,6 @@ match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m)
swap(__prefix_, __m.__prefix_);
swap(__suffix_, __m.__suffix_);
swap(__position_start_, __m.__position_start_);
swap(__ready_, __m.__ready_);
}
typedef match_results<const char*> cmatch;
@@ -5446,13 +5391,10 @@ bool
operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
const match_results<_BidirectionalIterator, _Allocator>& __y)
{
if (__x.__ready_ != __y.__ready_)
return false;
if (!__x.__ready_)
return true;
return __x.__matches_ == __y.__matches_ &&
__x.__prefix_ == __y.__prefix_ &&
__x.__suffix_ == __y.__suffix_;
__x.__suffix_ == __y.__suffix_ &&
__x.__position_start_ == __y.__position_start_;
}
template <class _BidirectionalIterator, class _Allocator>
@@ -5481,7 +5423,7 @@ bool
basic_regex<_CharT, _Traits>::__match_at_start_ecma(
const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool __at_first) const
regex_constants::match_flag_type __flags) const
{
vector<__state> __states;
ptrdiff_t __j = 0;
@@ -5498,7 +5440,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
__states.back().__loop_data_.resize(__loop_count());
__states.back().__node_ = __st;
__states.back().__flags_ = __flags;
__states.back().__at_first_ = __at_first;
bool __matched = false;
do
{
@@ -5547,7 +5488,7 @@ bool
basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool __at_first) const
regex_constants::match_flag_type __flags) const
{
deque<__state> __states;
ptrdiff_t __highest_j = 0;
@@ -5563,7 +5504,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
__states.back().__loop_data_.resize(__loop_count());
__states.back().__node_ = __st;
__states.back().__flags_ = __flags;
__states.back().__at_first_ = __at_first;
bool __matched = false;
do
{
@@ -5625,7 +5565,7 @@ bool
basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool __at_first) const
regex_constants::match_flag_type __flags) const
{
vector<__state> __states;
__state __best_state;
@@ -5644,7 +5584,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__states.back().__loop_data_.resize(__loop_count());
__states.back().__node_ = __st;
__states.back().__flags_ = __flags;
__states.back().__at_first_ = __at_first;
const _CharT* __current = __first;
bool __matched = false;
do
@@ -5710,13 +5649,13 @@ bool
basic_regex<_CharT, _Traits>::__match_at_start(
const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool __at_first) const
regex_constants::match_flag_type __flags) const
{
if ((__flags_ & 0x1F0) == ECMAScript)
return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
return __match_at_start_ecma(__first, __last, __m, __flags);
if (mark_count() == 0)
return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
return __match_at_start_posix_subs(__first, __last, __m, __flags, __at_first);
return __match_at_start_posix_nosubs(__first, __last, __m, __flags);
return __match_at_start_posix_subs(__first, __last, __m, __flags);
}
template <class _CharT, class _Traits>
@@ -5727,9 +5666,11 @@ basic_regex<_CharT, _Traits>::__search(
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags) const
{
if (__left_anchor_)
__flags |= regex_constants::match_continuous;
__m.__init(1 + mark_count(), __first, __last,
__flags & regex_constants::__no_update_pos);
if (__match_at_start(__first, __last, __m, __flags, true))
if (__match_at_start(__first, __last, __m, __flags))
{
__m.__prefix_.second = __m[0].first;
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
@@ -5743,7 +5684,7 @@ basic_regex<_CharT, _Traits>::__search(
for (++__first; __first != __last; ++__first)
{
__m.__matches_.assign(__m.size(), __m.__unmatched_);
if (__match_at_start(__first, __last, __m, __flags, false))
if (__match_at_start(__first, __last, __m, __flags))
{
__m.__prefix_.second = __m[0].first;
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;

View File

@@ -451,7 +451,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
__hm_ = _STD::max(this->pptr() + 1, __hm_);
__hm_ = max(this->pptr() + 1, __hm_);
if (__mode_ & ios_base::in)
{
char_type* __p = const_cast<char_type*>(__str_.data());

View File

@@ -1028,45 +1028,33 @@ private:
public:
static const size_type npos = -1;
_LIBCPP_INLINE_VISIBILITY basic_string();
_LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a);
basic_string();
explicit basic_string(const allocator_type& __a);
basic_string(const basic_string& __str);
basic_string(const basic_string& __str, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str);
_LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s);
_LIBCPP_INLINE_VISIBILITY
basic_string(const_pointer __s);
basic_string(const_pointer __s, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
basic_string(const_pointer __s, size_type __n);
_LIBCPP_INLINE_VISIBILITY
basic_string(const_pointer __s, size_type __n, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
basic_string(size_type __n, value_type __c);
_LIBCPP_INLINE_VISIBILITY
basic_string(size_type __n, value_type __c, const allocator_type& __a);
basic_string(const basic_string& __str, size_type __pos, size_type __n = npos,
const allocator_type& __a = allocator_type());
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
basic_string(_InputIterator __first, _InputIterator __last);
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
basic_string(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
basic_string(initializer_list<value_type> __il, const allocator_type& __a);
~basic_string();
basic_string& operator=(const basic_string& __str);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(basic_string&& __str);
#endif
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const_pointer __s) {return assign(__s);}
@@ -1098,7 +1086,7 @@ public:
_LIBCPP_INLINE_VISIBILITY size_type size() const
{return __is_long() ? __get_long_size() : __get_short_size();}
_LIBCPP_INLINE_VISIBILITY size_type length() const {return size();}
_LIBCPP_INLINE_VISIBILITY size_type max_size() const;
size_type max_size() const;
_LIBCPP_INLINE_VISIBILITY size_type capacity() const
{return (__is_long() ? __get_long_cap() : __min_cap) - 1;}
@@ -1108,7 +1096,6 @@ public:
void reserve(size_type res_arg = 0);
_LIBCPP_INLINE_VISIBILITY
void shrink_to_fit() {reserve();}
_LIBCPP_INLINE_VISIBILITY
void clear();
_LIBCPP_INLINE_VISIBILITY bool empty() const {return size() == 0;}
@@ -1123,7 +1110,6 @@ public:
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
_LIBCPP_INLINE_VISIBILITY
basic_string& append(const basic_string& __str);
basic_string& append(const basic_string& __str, size_type __pos, size_type __n);
basic_string& append(const_pointer __s, size_type __n);
@@ -1148,14 +1134,12 @@ public:
basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
void push_back(value_type __c);
_LIBCPP_INLINE_VISIBILITY
void pop_back();
_LIBCPP_INLINE_VISIBILITY reference front();
_LIBCPP_INLINE_VISIBILITY const_reference front() const;
_LIBCPP_INLINE_VISIBILITY reference back();
_LIBCPP_INLINE_VISIBILITY const_reference back() const;
reference front();
const_reference front() const;
reference back();
const_reference back() const;
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(const basic_string& __str);
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n);
basic_string& assign(const_pointer __s, size_type __n);
@@ -1179,14 +1163,12 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
_LIBCPP_INLINE_VISIBILITY
basic_string& insert(size_type __pos1, const basic_string& __str);
basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n);
basic_string& insert(size_type __pos, const_pointer __s, size_type __n);
basic_string& insert(size_type __pos, const_pointer __s);
basic_string& insert(size_type __pos, size_type __n, value_type __c);
iterator insert(const_iterator __pos, value_type __c);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, size_type __n, value_type __c);
template<class _InputIterator>
typename enable_if
@@ -1208,24 +1190,17 @@ public:
{return insert(__pos, __il.begin(), __il.end());}
basic_string& erase(size_type __pos = 0, size_type __n = npos);
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __pos);
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2);
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2);
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s);
basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
template<class _InputIterator>
typename enable_if
@@ -1239,10 +1214,8 @@ public:
{return replace(__i1, __i2, __il.begin(), __il.end());}
size_type copy(pointer __s, size_type __n, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
basic_string substr(size_type __pos = 0, size_type __n = npos) const;
_LIBCPP_INLINE_VISIBILITY
void swap(basic_string& __str);
_LIBCPP_INLINE_VISIBILITY const_pointer c_str() const {return data();}
@@ -1250,62 +1223,44 @@ public:
_LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const {return __alloc();}
_LIBCPP_INLINE_VISIBILITY
size_type find(const basic_string& __str, size_type __pos = 0) const;
size_type find(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find(const_pointer __s, size_type __pos = 0) const;
size_type find(value_type __c, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type rfind(const basic_string& __str, size_type __pos = npos) const;
size_type rfind(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type rfind(const_pointer __s, size_type __pos = npos) const;
size_type rfind(value_type __c, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_of(const basic_string& __str, size_type __pos = 0) const;
size_type find_first_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_of(const_pointer __s, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_of(value_type __c, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const basic_string& __str, size_type __pos = npos) const;
size_type find_last_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const_pointer __s, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(value_type __c, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const;
size_type find_first_not_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(const_pointer __s, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(value_type __c, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const;
size_type find_last_not_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const_pointer __s, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(value_type __c, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
int compare(const basic_string& __str) const;
_LIBCPP_INLINE_VISIBILITY
int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const;
int compare(const_pointer __s) const;
int compare(size_type __pos1, size_type __n1, const_pointer __s) const;
int compare(size_type __pos1, size_type __n1, const_pointer __s, size_type __n2) const;
_LIBCPP_INLINE_VISIBILITY bool __invariants() const;
bool __invariants() const;
private:
_LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __r_.second();}
_LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __r_.second();}
@@ -1383,7 +1338,6 @@ private:
size_type __n_copy, size_type __n_del,
size_type __n_add, const_pointer __p_new_stuff);
_LIBCPP_INLINE_VISIBILITY
void __erase_to_end(size_type __pos);
_LIBCPP_INLINE_VISIBILITY
@@ -1407,9 +1361,7 @@ private:
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, false_type);
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, true_type);
#endif
@@ -1428,8 +1380,8 @@ private:
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
{}
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
_LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(size_type);
void __invalidate_all_iterators();
void __invalidate_iterators_past(size_type);
friend basic_string operator+<>(const basic_string&, const basic_string&);
friend basic_string operator+<>(const value_type*, const basic_string&);
@@ -1789,6 +1741,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_t
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>::~basic_string()
{
__invalidate_all_iterators();
@@ -3251,7 +3204,6 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type _
// __invariants
template<class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
basic_string<_CharT, _Traits, _Allocator>::__invariants() const
{
@@ -3643,6 +3595,10 @@ swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Tra
__lhs.swap(__rhs);
}
template<class _CharT, class _Traits, class _Allocator>
struct __is_zero_default_constructible<basic_string<_CharT, _Traits, _Allocator> >
: public integral_constant<bool, __is_zero_default_constructible<_Allocator>::value> {};
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef basic_string<char16_t> u16string;

View File

@@ -297,7 +297,7 @@ public:
class __assoc_sub_state;
class _LIBCPP_HIDDEN __thread_struct_imp;
class __thread_struct_imp;
class __thread_struct
{

View File

@@ -74,8 +74,11 @@ const unspecified ignore;
template <class... T> tuple<V...> make_tuple(T&&...);
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...);
template <class... T> tuple<T&...> tie(T&...);
template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls);
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, const tuple<U...>&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, const tuple<U...>&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, tuple<U...>&&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, tuple<U...>&&);
// 20.4.1.4, tuple helper classes:
template <class T> class tuple_size; // undefined
template <class... T> class tuple_size<tuple<T...>>;
@@ -120,7 +123,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// tuple_size
template <class ..._Tp>
class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...> >
class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...>>
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
@@ -128,10 +131,10 @@ class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...> >
// tuple_element
template <size_t _Ip, class ..._Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, tuple<_Tp...> >
class _LIBCPP_VISIBLE tuple_element<_Ip, tuple<_Tp...>>
{
public:
typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
typedef typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
};
// __tuple_leaf
@@ -373,7 +376,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <class _Tuple,
class = typename enable_if
<
__tuple_convertible<_Tuple, tuple<_Tp...> >::value
__tuple_convertible<_Tuple, tuple<_Tp...>>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
@@ -385,7 +388,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <class _Alloc, class _Tuple,
class = typename enable_if
<
__tuple_convertible<_Tuple, tuple<_Tp...> >::value
__tuple_convertible<_Tuple, tuple<_Tp...>>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
@@ -400,7 +403,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
__tuple_assignable<_Tuple, tuple<_Tp...> >::value,
__tuple_assignable<_Tuple, tuple<_Tp...>>::value,
__tuple_impl&
>::type
operator=(_Tuple&& __t)
@@ -425,11 +428,11 @@ class _LIBCPP_VISIBLE tuple
base base_;
template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&);
typename tuple_element<_Jp, tuple<_Up...>>::type& get(tuple<_Up...>&);
template <size_t _Jp, class ..._Up> friend
const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&);
const typename tuple_element<_Jp, tuple<_Up...>>::type& get(const tuple<_Up...>&);
template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&);
typename tuple_element<_Jp, tuple<_Up...>>::type&& get(tuple<_Up...>&&);
public:
_LIBCPP_INLINE_VISIBILITY
@@ -567,30 +570,29 @@ swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) {__t.swap(__u);}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&
typename tuple_element<_Ip, tuple<_Tp...>>::type&
get(tuple<_Tp...>& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get();
}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
get(const tuple<_Tp...>& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
typename tuple_element<_Ip, tuple<_Tp...>>::type&&
get(tuple<_Tp...>&& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<type&&>(
static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
return static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get();
}
// tie
@@ -627,7 +629,7 @@ struct ___make_tuple_return
};
template <class _Tp>
struct ___make_tuple_return<reference_wrapper<_Tp> >
struct ___make_tuple_return<reference_wrapper<_Tp>>
{
typedef _Tp& type;
};
@@ -749,140 +751,72 @@ operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
// tuple_cat
template <class _Tp, class _Up> struct __tuple_cat_type;
template <class ..._Ttypes, class ..._Utypes>
struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
{
typedef tuple<_Ttypes..., _Utypes...> type;
};
template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
struct __tuple_cat_return_1
{
};
template <class ..._Types, class _Tuple0>
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
{
typedef typename __tuple_cat_type<tuple<_Types...>,
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type
type;
};
template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_1<
typename __tuple_cat_type<
tuple<_Types...>,
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type
>::type,
__tuple_like<typename remove_reference<_Tuple1>::type>::value,
_Tuple1, _Tuples...>
{
};
template <class ..._Tuples> struct __tuple_cat_return;
template <class _Tuple0, class ..._Tuples>
struct __tuple_cat_return<_Tuple0, _Tuples...>
: public __tuple_cat_return_1<tuple<>,
__tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0,
_Tuples...>
{
};
template <>
struct __tuple_cat_return<>
{
typedef tuple<> type;
};
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline _LIBCPP_INLINE_VISIBILITY
tuple<>
tuple_cat()
tuple<_Tp..., _Up...>
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
{
return tuple<>();
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., get<_I2>(__y)...);
}
template <class _R, class _Indices, class _Tuple0, class ..._Tuples>
struct __tuple_cat_return_ref_imp;
template <class ..._Types, size_t ..._I0, class _Tuple0>
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
{
typedef typename remove_reference<_Tuple0>::type _T0;
typedef tuple<_Types..., typename __apply_cv<_Tuple0,
typename tuple_element<_I0, _T0>::type>::type&&...> type;
};
template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
_Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_ref_imp<
tuple<_Types..., typename __apply_cv<_Tuple0,
typename tuple_element<_I0,
typename remove_reference<_Tuple0>::type>::type>::type&&...>,
typename __make_tuple_indices<tuple_size<typename
remove_reference<_Tuple1>::type>::value>::type,
_Tuple1, _Tuples...>
{
};
template <class _Tuple0, class ..._Tuples>
struct __tuple_cat_return_ref
: public __tuple_cat_return_ref_imp<tuple<>,
typename __make_tuple_indices<
tuple_size<typename remove_reference<_Tuple0>::type>::value
>::type, _Tuple0, _Tuples...>
{
};
template <class _Types, class _I0, class _J0>
struct __tuple_cat;
template <class ..._Types, size_t ..._I0, size_t ..._J0>
struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> >
{
template <class _Tuple0>
_LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
operator()(tuple<_Types...> __t, _Tuple0&& __t0)
{
return _STD::forward_as_tuple(_STD::forward<_Types>(get<_I0>(__t))...,
get<_J0>(_STD::forward<_Tuple0>(__t0))...);
}
template <class _Tuple0, class _Tuple1, class ..._Tuples>
_LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
{
typedef typename remove_reference<_Tuple0>::type _T0;
typedef typename remove_reference<_Tuple1>::type _T1;
return __tuple_cat<
tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
typename __make_tuple_indices<tuple_size<_T1>::value>::type>()
(_STD::forward_as_tuple(
_STD::forward<_Types>(get<_I0>(__t))...,
get<_J0>(_STD::forward<_Tuple0>(__t0))...
),
_STD::forward<_Tuple1>(__t1),
_STD::forward<_Tuples>(__tpls)...);
}
};
template <class _Tuple0, class... _Tuples>
template <class... _Tp, class... _Up>
inline _LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return<_Tuple0, _Tuples...>::type
tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
tuple<_Tp..., _Up...>
tuple_cat(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
typedef typename remove_reference<_Tuple0>::type _T0;
return __tuple_cat<tuple<>, __tuple_indices<>,
typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
(tuple<>(), _STD::forward<_Tuple0>(__t0),
_STD::forward<_Tuples>(__tpls)...);
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp..., _Up...>
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
{
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., get<_I2>(__y)...);
}
template <class... _Tp, class... _Up>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp..., _Up...>
tuple_cat(tuple<_Tp...>&& __x, const tuple<_Up...>& __y)
{
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp..., _Up...>
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
{
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., _STD::forward<_Up>(get<_I2>(__y))...);
}
template <class... _Tp, class... _Up>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp..., _Up...>
tuple_cat(const tuple<_Tp...>& __x, tuple<_Up...>&& __y)
{
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp..., _Up...>
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
{
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., _STD::forward<_Up>(get<_I2>(__y))...);
}
template <class... _Tp, class... _Up>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp..., _Up...>
tuple_cat(tuple<_Tp...>&& __x, tuple<_Up...>&& __y)
{
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class ..._Tp, class _Alloc>

View File

@@ -165,11 +165,10 @@ struct _LIBCPP_VISIBLE integral_constant
static constexpr _Tp value = __v;
typedef _Tp value_type;
typedef integral_constant type;
_LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
constexpr
_LIBCPP_INLINE_VISIBILITY
constexpr operator value_type() {return value;}
#endif
operator value_type() const {return value;}
};
template <class _Tp, _Tp __v>
@@ -211,14 +210,6 @@ template <> struct __is_void<void> : public true_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_void
: public __is_void<typename remove_cv<_Tp>::type> {};
// __is_nullptr_t
template <class _Tp> struct ____is_nullptr_t : public false_type {};
template <> struct ____is_nullptr_t<nullptr_t> : public true_type {};
template <class _Tp> struct _LIBCPP_VISIBLE __is_nullptr_t
: public ____is_nullptr_t<typename remove_cv<_Tp>::type> {};
// is_integral
template <class _Tp> struct __is_integral : public false_type {};
@@ -400,8 +391,7 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_arithmetic
// is_fundamental
template <class _Tp> struct _LIBCPP_VISIBLE is_fundamental
: public integral_constant<bool, is_void<_Tp>::value ||
__is_nullptr_t<_Tp>::value ||
: public integral_constant<bool, is_void<_Tp>::value ||
is_arithmetic<_Tp>::value> {};
// is_scalar
@@ -410,11 +400,8 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_scalar
: public integral_constant<bool, is_arithmetic<_Tp>::value ||
is_member_pointer<_Tp>::value ||
is_pointer<_Tp>::value ||
__is_nullptr_t<_Tp>::value ||
is_enum<_Tp>::value > {};
template <> struct _LIBCPP_VISIBLE is_scalar<nullptr_t> : public true_type {};
// is_object
template <class _Tp> struct _LIBCPP_VISIBLE is_object
@@ -610,13 +597,6 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_abstract : public __libcpp_abstra
// is_convertible
#if __has_feature(is_convertible_to)
template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
: public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
#else // __has_feature(is_convertible_to)
namespace __is_convertible_imp
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -717,18 +697,8 @@ template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
};
#endif // __has_feature(is_convertible_to)
// is_base_of
#if __has_feature(is_base_of)
template <class _Bp, class _Dp>
struct _LIBCPP_VISIBLE is_base_of
: public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
#else // __has_feature(is_base_of)
// (C) Copyright Rani Sharoni 2003.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -775,8 +745,6 @@ struct _LIBCPP_VISIBLE is_base_of
{
};
#endif // __has_feature(is_base_of)
// is_empty
template <class _Tp>
@@ -1426,31 +1394,31 @@ public:
typedef decltype(declval<_Fn>()(declval<_ArgTypes>()...)) type;
};
template <class _MP, class _Tp, bool _IsMemberFunctionPtr, class ..._Args>
template <class _MP, class _Tp, class ..._Args>
struct __result_of_mp {};
// member function pointer
template <class _R, class _Class, class _Tp, class ..._Params, class ..._Args>
struct __result_of_mp<_R (_Class::*)(_Params...), _Tp, true, _Args...>
struct __result_of_mp<_R (_Class::*)(_Params...), _Tp, _Args...>
{
typedef _R type;
};
template <class _R, class _Class, class _Tp, class ..._Params, class ..._Args>
struct __result_of_mp<_R (_Class::*)(_Params...) const, _Tp, true, _Args...>
struct __result_of_mp<_R (_Class::*)(_Params...) const, _Tp, _Args...>
{
typedef _R type;
};
template <class _R, class _Class, class _Tp, class ..._Params, class ..._Args>
struct __result_of_mp<_R (_Class::*)(_Params...) volatile, _Tp, true, _Args...>
struct __result_of_mp<_R (_Class::*)(_Params...) volatile, _Tp, _Args...>
{
typedef _R type;
};
template <class _R, class _Class, class _Tp, class ..._Params, class ..._Args>
struct __result_of_mp<_R (_Class::*)(_Params...) const volatile, _Tp, true, _Args...>
struct __result_of_mp<_R (_Class::*)(_Params...) const volatile, _Tp, _Args...>
{
typedef _R type;
};
@@ -1473,7 +1441,7 @@ struct __result_of_mdp<_R _Class::*, _Tp, true>
};
template <class _R, class _Class, class _Tp>
struct __result_of_mp<_R _Class::*, _Tp, false>
struct __result_of_mp<_R _Class::*, _Tp>
: public __result_of_mdp<_R _Class::*, _Tp,
is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
{
@@ -1481,8 +1449,7 @@ struct __result_of_mp<_R _Class::*, _Tp, false>
template <class _Fn, class _Tp, class ..._ArgTypes>
class __result_of<_Fn(_Tp, _ArgTypes...), false> // _Fn must be member pointer
: public __result_of_mp<_Fn, _Tp, is_member_function_pointer<_Fn>::value,
_ArgTypes...>
: public __result_of_mp<_Fn, _Tp, _ArgTypes...>
{
};
@@ -2334,6 +2301,9 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_pod
#endif // _LIBCPP_HAS_TYPE_TRAITS
template <class _Tp> struct __is_zero_default_constructible
: public integral_constant<bool, is_scalar<_Tp>::value || is_empty<_Tp>::value> {};
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void

View File

@@ -424,9 +424,9 @@ public:
void operator()(pointer __p)
{
if (__second_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -979,10 +979,10 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first),
__node_traits::construct(__na, addressof(__h->__value_.first),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second),
__node_traits::construct(__na, addressof(__h->__value_.second),
_STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
@@ -999,7 +999,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_),
__node_traits::construct(__na, addressof(__h->__value_),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
@@ -1032,9 +1032,9 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type&
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__node_traits::construct(__na, addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _STD::move(__h);
}
@@ -1560,10 +1560,10 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first),
__node_traits::construct(__na, addressof(__h->__value_.first),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second),
__node_traits::construct(__na, addressof(__h->__value_.second),
_STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
@@ -1580,7 +1580,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_),
__node_traits::construct(__na, addressof(__h->__value_),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;

View File

@@ -222,8 +222,6 @@ struct _LIBCPP_VISIBLE pair
second(_STD::forward<_U2>(__u2))
{}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template<class _Tuple,
class = typename enable_if<__tuple_convertible<_Tuple, pair>::value>::type>
_LIBCPP_INLINE_VISIBILITY
@@ -234,7 +232,7 @@ struct _LIBCPP_VISIBLE pair
typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p)))
{}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
_LIBCPP_INLINE_VISIBILITY
@@ -245,6 +243,8 @@ struct _LIBCPP_VISIBLE pair
typename __make_tuple_indices<sizeof...(_Args2) >::type())
{}
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tuple,
class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type>
_LIBCPP_INLINE_VISIBILITY
@@ -259,8 +259,6 @@ struct _LIBCPP_VISIBLE pair
return *this;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)
@@ -271,7 +269,6 @@ private:
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
_LIBCPP_INLINE_VISIBILITY
pair(piecewise_construct_t,
tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
__tuple_indices<_I1...>, __tuple_indices<_I2...>);

View File

@@ -318,8 +318,8 @@ protected:
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY __vector_base();
_LIBCPP_INLINE_VISIBILITY __vector_base(const allocator_type& __a);
__vector_base();
__vector_base(const allocator_type& __a);
~__vector_base();
_LIBCPP_INLINE_VISIBILITY void clear() {__destruct_at_end(__begin_);}
@@ -327,8 +327,8 @@ protected:
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last)
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last, false_type);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last, true_type);
void __destruct_at_end(const_pointer __new_last, false_type);
void __destruct_at_end(const_pointer __new_last, true_type);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __vector_base& __c)
@@ -484,9 +484,7 @@ public:
template <class _ForwardIterator>
vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);
_LIBCPP_INLINE_VISIBILITY
vector(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
vector(initializer_list<value_type> __il, const allocator_type& __a);
#ifdef _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY
@@ -495,14 +493,10 @@ public:
vector(const vector& __x);
vector(const vector& __x, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(const vector& __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
vector(vector&& __x);
_LIBCPP_INLINE_VISIBILITY
vector(vector&& __x, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __x);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -532,10 +526,10 @@ public:
_LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const {return this->__alloc();}
_LIBCPP_INLINE_VISIBILITY iterator begin();
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const;
_LIBCPP_INLINE_VISIBILITY iterator end();
_LIBCPP_INLINE_VISIBILITY const_iterator end() const;
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
_LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
@@ -569,7 +563,7 @@ public:
_LIBCPP_INLINE_VISIBILITY const value_type* data() const
{return _STD::__to_raw_pointer(this->__begin_);}
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
void push_back(const_reference __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void push_back(value_type&& __x);
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -607,7 +601,7 @@ public:
iterator insert(const_iterator __position, initializer_list<value_type> __il)
{return insert(__position, __il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
iterator erase(const_iterator __position);
iterator erase(const_iterator __first, const_iterator __last);
_LIBCPP_INLINE_VISIBILITY void clear() {__base::clear();}
@@ -620,12 +614,16 @@ public:
bool __invariants() const;
private:
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
void __invalidate_all_iterators();
void allocate(size_type __n);
void deallocate();
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
size_type __recommend(size_type __new_size) const;
void __construct_at_end(size_type __n);
void __construct_at_end(size_type __n, false_type);
void __construct_at_end(size_type __n, true_type);
void __construct_at_end(size_type __n, const_reference __x);
void __construct_at_end(size_type __n, const_reference __x, false_type);
void __construct_at_end(size_type __n, const_reference __x, true_type);
template <class _ForwardIterator>
typename enable_if
<
@@ -636,9 +634,7 @@ private:
void __move_construct_at_end(pointer __first, pointer __last);
void __append(size_type __n);
void __append(size_type __n, const_reference __x);
_LIBCPP_INLINE_VISIBILITY
iterator __make_iter(pointer __p);
_LIBCPP_INLINE_VISIBILITY
const_iterator __make_iter(const_pointer __p) const;
void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
@@ -735,8 +731,16 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
{
__construct_at_end(__n, __is_zero_default_constructible<value_type>());
}
template <class _Tp, class _Allocator>
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
{
allocator_type& __a = this->__alloc();
do
@@ -747,6 +751,15 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
{
_STD::memset(this->__end_, 0, __n*sizeof(value_type));
this->__end_ += __n;
}
// Copy constructs __n objects starting at __end_ from __x
// throws if construction throws
// Precondition: __n > 0
@@ -757,6 +770,14 @@ template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
__construct_at_end(__n, __x, integral_constant<bool, is_trivially_copy_constructible<value_type>::value &&
is_trivially_copy_assignable<value_type>::value>());
}
template <class _Tp, class _Allocator>
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
{
allocator_type& __a = this->__alloc();
do
@@ -767,6 +788,15 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
{
_STD::fill_n(this->__end_, __n, __x);
this->__end_ += __n;
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator>
typename enable_if
@@ -1101,7 +1131,7 @@ vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u)
if (__n <= capacity())
{
size_type __s = size();
_STD::fill_n(this->__begin_, _STD::min(__n, __s), __u);
_STD::fill_n(this->__begin_, min(__n, __s), __u);
if (__n > __s)
__construct_at_end(__n - __s, __u);
else
@@ -1727,8 +1757,8 @@ private:
{return (__n - 1) / __bits_per_word + 1;}
public:
_LIBCPP_INLINE_VISIBILITY vector();
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a);
vector();
explicit vector(const allocator_type& __a);
~vector();
explicit vector(size_type __n);
vector(size_type __n, const value_type& __v);
@@ -1755,9 +1785,9 @@ public:
vector(initializer_list<value_type> __il, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY vector(vector&& __v);
vector(vector&& __v);
vector(vector&& __v, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __v);
vector& operator=(vector&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
vector& operator=(initializer_list<value_type> __il)
@@ -1844,7 +1874,7 @@ public:
iterator insert(const_iterator __position, initializer_list<value_type> __il)
{return insert(__position, __il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
iterator erase(const_iterator __position);
iterator erase(const_iterator __first, const_iterator __last);
_LIBCPP_INLINE_VISIBILITY void clear() {__size_ = 0;}
@@ -1857,13 +1887,13 @@ public:
bool __invariants() const;
private:
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
void __invalidate_all_iterators();
void allocate(size_type __n);
void deallocate();
_LIBCPP_INLINE_VISIBILITY static size_type __align(size_type __new_size)
{return __new_size + (__bits_per_word-1) & ~(__bits_per_word-1);};
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
_LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x);
size_type __recommend(size_type __new_size) const;
void __construct_at_end(size_type __n, bool __x);
template <class _ForwardIterator>
typename enable_if
<
@@ -2220,6 +2250,7 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const alloca
}
template <class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
vector<bool, _Allocator>::~vector()
{
if (__begin_ != 0)
@@ -2724,6 +2755,10 @@ struct _LIBCPP_VISIBLE hash<vector<bool, _Allocator> >
{return __vec.__hash_code();}
};
template <class _Tp, class _Allocator>
struct __is_zero_default_constructible<vector<_Tp, _Allocator> >
: public integral_constant<bool, __is_zero_default_constructible<_Allocator>::value> {};
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool

View File

@@ -1,57 +0,0 @@
# Get sources
file(GLOB_RECURSE sources ../src/*.cpp)
# Add all the headers to the project for IDEs.
if (MSVC_IDE OR XCODE)
file(GLOB_RECURSE headers ../include/*)
# Force them all into the headers dir on MSVC, otherwise they end up at
# project scope because they don't have extensions.
if (MSVC_IDE)
source_group("Header Files" FILES ${headers})
endif()
endif()
if (LIBCXX_ENABLE_SHARED)
add_library(cxx SHARED
${sources}
)
else()
add_library(cxx STATIC
${sources}
)
endif()
# Generate library list.
append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
append_if(libraries LIBCXX_HAS_C_LIB c)
append_if(libraries LIBCXX_HAS_M_LIB m)
append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
target_link_libraries(cxx ${libraries})
# Setup flags.
append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
set_target_properties(cxx
PROPERTIES
COMPILE_FLAGS "${compile_flags}"
LINK_FLAGS "${link_flags}"
OUTPUT_NAME "c++"
VERSION "1.0"
SOVERSION "1"
)
install(TARGETS cxx
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(DIRECTORY ../include/
DESTINATION include/libcxx/v1
FILES_MATCHING
PATTERN "*"
PATTERN ".svn" EXCLUDE
PATTERN ".git" EXCLUDE
)

View File

@@ -2,7 +2,7 @@
#
# Set the $TRIPLE environment variable to your system's triple before
# running this script. If you set $CXX, that will be used to compile
# the library. Otherwise we'll use clang++.
# the library. Otherwise we'll use g++.
set -e
@@ -36,23 +36,19 @@ case $TRIPLE in
SOEXT=dylib
if [ "$MACOSX_DEPLOYMENT_TARGET" == "10.6" ]
then
EXTRA_FLAGS="-std=c++0x -U__STRICT_ANSI__"
LDSHARED_FLAGS="-o libc++.1.dylib \
-dynamiclib -nodefaultlibs -current_version 1 \
-compatibility_version 1 \
-install_name /usr/lib/libc++.1.dylib \
-install_name /usr/lib/libc++.dylib \
-Wl,-reexport_library,/usr/lib/libc++abi.dylib \
-Wl,-unexported_symbols_list,libc++unexp.exp \
/usr/lib/libSystem.B.dylib"
else
EXTRA_FLAGS="-std=c++0x"
LDSHARED_FLAGS="-o libc++.1.dylib \
-dynamiclib -nodefaultlibs \
-current_version ${RC_ProjectSourceVersion} -compatibility_version 1 \
-install_name /usr/lib/libc++.1.dylib \
-install_name /usr/lib/libc++.dylib \
${SDKROOT}/usr/lib/libc++abi.dylib \
-lSystem \
-Wl,-unexported_symbols_list,libc++unexp.exp \
-Wl,-reexported_symbols_list,libc++abi.exp \
-Wl,-force_symbols_not_weak_list,notweak.exp"
fi
@@ -74,11 +70,11 @@ fi
set -x
for FILE in ../src/*.cpp; do
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -nostdinc++ -I../include $FILE
$CXX -c -g -Os $RC_CFLAGS -nostdinc++ -I../include $FILE
done
cc *.o $RC_CFLAGS $LDSHARED_FLAGS
cc *.o $RC_CFLAGS $LDSHARED_FLAGS
#libtool -static -o libc++.a *.o

View File

@@ -1,19 +0,0 @@
# all guard variables
__ZGVNSt3__*
# all vtables
# __ZTV*
# all VTT
# __ZTT*
# all non-virtual thunks
# __ZTh*
# all virtual thunks
# __ZTv*
# typeinfo for std::__1::__types
# There are no std::__types
# __ZTINSt3__1[0-9][0-9]*__*
# typeinfo name for std::__1::__types
__ZTSNSt3__1[0-9][0-9]*__*
# anything using __hidden_allocator
*__hidden_allocator*
# anything using __sso_allocator
*__sso_allocator*

View File

@@ -165,7 +165,7 @@ ios_base::iword(int index)
size_t newcap;
const size_t mx = std::numeric_limits<size_t>::max();
if (req_size < mx/2)
newcap = _STD::max(2 * __iarray_cap_, req_size);
newcap = max(2 * __iarray_cap_, req_size);
else
newcap = mx;
long* iarray = (long*)realloc(__iarray_, newcap * sizeof(long));
@@ -193,7 +193,7 @@ ios_base::pword(int index)
size_t newcap;
const size_t mx = std::numeric_limits<size_t>::max();
if (req_size < mx/2)
newcap = _STD::max(2 * __parray_cap_, req_size);
newcap = max(2 * __parray_cap_, req_size);
else
newcap = mx;
void** parray = (void**)realloc(__parray_, newcap * sizeof(void*));
@@ -223,7 +223,7 @@ ios_base::register_callback(event_callback fn, int index)
size_t newcap;
const size_t mx = std::numeric_limits<size_t>::max();
if (req_size < mx/2)
newcap = _STD::max(2 * __event_cap_, req_size);
newcap = max(2 * __event_cap_, req_size);
else
newcap = mx;
event_callback* fns = (event_callback*)realloc(__fn_, newcap * sizeof(event_callback));

View File

@@ -21,6 +21,8 @@
#include <langinfo.h>
#include <stdlib.h>
// FIXME: Locales are hard.
#if __APPLE__
_LIBCPP_BEGIN_NAMESPACE_STD
namespace {
@@ -674,93 +676,61 @@ ctype<wchar_t>::~ctype()
bool
ctype<wchar_t>::do_is(mask m, char_type c) const
{
#ifdef __APPLE__
return isascii(c) ? _DefaultRuneLocale.__runetype[c] & m : false;
#else
return false;
#endif
}
const wchar_t*
ctype<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const
{
#ifdef __APPLE__
for (; low != high; ++low, ++vec)
*vec = static_cast<mask>(isascii(*low) ? _DefaultRuneLocale.__runetype[*low] : 0);
return low;
#else
return NULL;
#endif
}
const wchar_t*
ctype<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* high) const
{
#ifdef __APPLE__
for (; low != high; ++low)
if (isascii(*low) && (_DefaultRuneLocale.__runetype[*low] & m))
break;
return low;
#else
return NULL;
#endif
}
const wchar_t*
ctype<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high) const
{
#ifdef __APPLE__
for (; low != high; ++low)
if (!(isascii(*low) && (_DefaultRuneLocale.__runetype[*low] & m)))
break;
return low;
#else
return NULL;
#endif
}
wchar_t
ctype<wchar_t>::do_toupper(char_type c) const
{
#ifdef __APPLE__
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
#else
return 0;
#endif
}
const wchar_t*
ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
{
#ifdef __APPLE__
for (; low != high; ++low)
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
return low;
#else
return NULL;
#endif
}
wchar_t
ctype<wchar_t>::do_tolower(char_type c) const
{
#ifdef __APPLE__
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
#else
return 0;
#endif
}
const wchar_t*
ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
{
#ifdef __APPLE__
for (; low != high; ++low)
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
return low;
#else
return NULL;
#endif
}
wchar_t
@@ -805,10 +775,8 @@ ctype<char>::ctype(const mask* tab, bool del, size_t refs)
__tab_(tab),
__del_(del)
{
#ifdef __APPLE__
if (__tab_ == 0)
__tab_ = _DefaultRuneLocale.__runetype;
#endif
}
ctype<char>::~ctype()
@@ -820,45 +788,29 @@ ctype<char>::~ctype()
char
ctype<char>::do_toupper(char_type c) const
{
#ifdef __APPLE__
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
#else
return 0;
#endif
}
const char*
ctype<char>::do_toupper(char_type* low, const char_type* high) const
{
#ifdef __APPLE__
for (; low != high; ++low)
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
return low;
#else
return NULL;
#endif
}
char
ctype<char>::do_tolower(char_type c) const
{
#ifdef __APPLE__
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
#else
return 0;
#endif
}
const char*
ctype<char>::do_tolower(char_type* low, const char_type* high) const
{
#ifdef __APPLE__
for (; low != high; ++low)
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
return low;
#else
return NULL;
#endif
}
char
@@ -897,11 +849,7 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
const ctype<char>::mask*
ctype<char>::classic_table() throw()
{
#ifdef __APPLE__
return _DefaultRuneLocale.__runetype;
#else
return NULL;
#endif
}
// template <> class ctype_byname<char>
@@ -999,7 +947,6 @@ ctype_byname<wchar_t>::do_is(mask m, char_type c) const
const wchar_t*
ctype_byname<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const
{
#ifdef __APPLE__
for (; low != high; ++low, ++vec)
{
if (isascii(*low))
@@ -1028,9 +975,6 @@ ctype_byname<wchar_t>::do_is(const char_type* low, const char_type* high, mask*
}
}
return low;
#else
return NULL;
#endif
}
const wchar_t*
@@ -1082,49 +1026,33 @@ ctype_byname<wchar_t>::do_tolower(char_type* low, const char_type* high) const
wchar_t
ctype_byname<wchar_t>::do_widen(char c) const
{
#ifdef __APPLE__
return btowc_l(c, __l);
#else
return 0;
#endif
}
const char*
ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const
{
#ifdef __APPLE__
for (; low != high; ++low, ++dest)
*dest = btowc_l(*low, __l);
return low;
#else
return NULL;
#endif
}
char
ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const
{
#ifdef __APPLE__
int r = wctob_l(c, __l);
return r != WEOF ? static_cast<char>(r) : dfault;
#else
return 0;
#endif
}
const wchar_t*
ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const
{
#ifdef __APPLE__
for (; low != high; ++low, ++dest)
{
int r = wctob_l(*low, __l);
*dest = r != WEOF ? static_cast<char>(r) : dfault;
}
return low;
#else
return NULL;
#endif
}
// template <> class codecvt<char, char, mbstate_t>
@@ -1220,7 +1148,6 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
{
#ifdef __APPLE__
// look for first internal null in frm
const intern_type* fend = frm;
for (; fend != frm_end; ++fend)
@@ -1270,9 +1197,6 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
}
}
return frm_nxt == frm_end ? ok : partial;
#else
return error;
#endif
}
codecvt<wchar_t, char, mbstate_t>::result
@@ -1280,7 +1204,6 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
{
#ifdef __APPLE__
// look for first internal null in frm
const extern_type* fend = frm;
for (; fend != frm_end; ++fend)
@@ -1338,16 +1261,12 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
}
}
return frm_nxt == frm_end ? ok : partial;
#else
return error;
#endif
}
codecvt<wchar_t, char, mbstate_t>::result
codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
{
#ifdef __APPLE__
to_nxt = to;
extern_type tmp[MB_LEN_MAX];
size_t n = wcrtomb_l(tmp, intern_type(), &st, __l);
@@ -1359,15 +1278,11 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
for (extern_type* p = tmp; n; --n) // write it
*to_nxt++ = *p++;
return ok;
#else
return error;
#endif
}
int
codecvt<wchar_t, char, mbstate_t>::do_encoding() const throw()
{
#ifdef __APPLE__
if (mbtowc_l(0, 0, MB_LEN_MAX, __l) == 0)
{
// stateless encoding
@@ -1376,9 +1291,6 @@ codecvt<wchar_t, char, mbstate_t>::do_encoding() const throw()
return 0;
}
return -1;
#else
return 0;
#endif
}
bool
@@ -1391,7 +1303,6 @@ int
codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
const extern_type* frm, const extern_type* frm_end, size_t mx) const
{
#ifdef __APPLE__
int nbytes = 0;
for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t)
{
@@ -1412,19 +1323,12 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
}
}
return nbytes;
#else
return 0;
#endif
}
int
codecvt<wchar_t, char, mbstate_t>::do_max_length() const throw()
{
#ifdef __APPLE__
return __l == 0 ? 1 : MB_CUR_MAX_L(__l);
#else
return 0;
#endif
}
// Valid UTF ranges
@@ -3965,7 +3869,6 @@ numpunct_byname<char>::~numpunct_byname()
void
numpunct_byname<char>::__init(const char* nm)
{
#ifdef __APPLE__
if (strcmp(nm, "C") != 0)
{
unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
@@ -3982,7 +3885,6 @@ numpunct_byname<char>::__init(const char* nm)
__grouping_ = lc->grouping;
// locallization for truename and falsename is not available
}
#endif
}
// numpunct_byname<wchar_t>
@@ -4006,7 +3908,6 @@ numpunct_byname<wchar_t>::~numpunct_byname()
void
numpunct_byname<wchar_t>::__init(const char* nm)
{
#ifdef __APPLE__
if (strcmp(nm, "C") != 0)
{
unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
@@ -4023,7 +3924,6 @@ numpunct_byname<wchar_t>::__init(const char* nm)
__grouping_ = lc->grouping;
// locallization for truename and falsename is not available
}
#endif
}
// num_get helpers
@@ -4588,7 +4488,6 @@ template <>
wstring
__time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
{
#ifdef __APPLE__
tm t;
t.tm_sec = 59;
t.tm_min = 55;
@@ -4733,9 +4632,6 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
++wbb;
}
return result;
#else
return wstring();
#endif
}
template <>
@@ -4779,7 +4675,6 @@ template <>
void
__time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
{
#ifdef __APPLE__
tm t = {0};
char buf[100];
size_t be;
@@ -4851,7 +4746,6 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
__r_ = __analyze('r', ct);
__x_ = __analyze('x', ct);
__X_ = __analyze('X', ct);
#endif
}
template <class CharT>
@@ -5113,7 +5007,6 @@ void
__time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
char __fmt, char __mod) const
{
#ifdef __APPLE__
char __nar[100];
char* __ne = __nar + 100;
__do_put(__nar, __ne, __tm, __fmt, __mod);
@@ -5123,7 +5016,6 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
if (j == -1)
__throw_runtime_error("locale not supported");
__we = __wb + j;
#endif
}
// moneypunct_byname
@@ -5368,7 +5260,6 @@ template<>
void
moneypunct_byname<char, false>::init(const char* nm)
{
#ifdef __APPLE__
typedef moneypunct<char, false> base;
unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -5401,14 +5292,12 @@ moneypunct_byname<char, false>::init(const char* nm)
__negative_sign_ = lc->negative_sign;
__init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
__init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
#endif
}
template<>
void
moneypunct_byname<char, true>::init(const char* nm)
{
#ifdef __APPLE__
typedef moneypunct<char, true> base;
unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -5441,14 +5330,12 @@ moneypunct_byname<char, true>::init(const char* nm)
__negative_sign_ = lc->negative_sign;
__init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn);
__init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn);
#endif
}
template<>
void
moneypunct_byname<wchar_t, false>::init(const char* nm)
{
#ifdef __APPLE__
typedef moneypunct<wchar_t, false> base;
unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -5504,14 +5391,12 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
}
__init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
__init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
#endif
}
template<>
void
moneypunct_byname<wchar_t, true>::init(const char* nm)
{
#ifdef __APPLE__
typedef moneypunct<wchar_t, true> base;
unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -5567,7 +5452,6 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
}
__init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn);
__init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn);
#endif
}
void __do_nothing(void*) {}
@@ -5642,3 +5526,4 @@ template class codecvt_byname<char32_t, char, mbstate_t>;
template class __vector_base_common<true>;
_LIBCPP_END_NAMESPACE_STD
#endif // __APPLE__

View File

@@ -229,7 +229,7 @@ string
__get_collation_name(const char* s)
{
const collationnames* i =
_STD::lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());
lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());
string r;
if (i != end(collatenames) && strcmp(s, i->elem_) == 0)
r = char(i->char_);
@@ -240,7 +240,7 @@ ctype_base::mask
__get_classname(const char* s, bool __icase)
{
const classnames* i =
_STD::lower_bound(begin(ClassNames), end(ClassNames), s, use_strcmp());
lower_bound(begin(ClassNames), end(ClassNames), s, use_strcmp());
ctype_base::mask r = 0;
if (i != end(ClassNames) && strcmp(s, i->elem_) == 0)
{

View File

@@ -130,7 +130,6 @@ strstreambuf::operator=(strstreambuf&& __rhs)
__pfree_ = __rhs.__pfree_;
__rhs.setg(nullptr, nullptr, nullptr);
__rhs.setp(nullptr, nullptr);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -302,7 +301,7 @@ strstreambuf::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmod
{
char* newpos = eback() + newoff;
if (pos_in)
setg(eback(), newpos, _STD::max(newpos, egptr()));
setg(eback(), newpos, max(newpos, egptr()));
if (pos_out)
{
// min(pbase, newpos), newpos, epptr()
@@ -332,7 +331,7 @@ strstreambuf::seekpos(pos_type __sp, ios_base::openmode __which)
{
char* newpos = eback() + newoff;
if (pos_in)
setg(eback(), newpos, _STD::max(newpos, egptr()));
setg(eback(), newpos, max(newpos, egptr()));
if (pos_out)
{
// min(pbase, newpos), newpos, epptr()

View File

@@ -92,25 +92,10 @@ __thread_local_data()
// __thread_struct_imp
template <class T>
class _LIBCPP_HIDDEN __hidden_allocator
class __thread_struct_imp
{
public:
typedef T value_type;
T* allocate(size_t __n)
{return static_cast<T*>(::operator new(__n * sizeof(T)));}
void deallocate(T* __p, size_t) {::operator delete((void*)__p);}
size_t max_size() const {return size_t(~0) / sizeof(T);}
};
class _LIBCPP_HIDDEN __thread_struct_imp
{
typedef vector<__assoc_sub_state*,
__hidden_allocator<__assoc_sub_state*> > _AsyncStates;
typedef vector<pair<condition_variable*, mutex*>,
__hidden_allocator<pair<condition_variable*, mutex*> > > _Notify;
typedef vector<__assoc_sub_state*> _AsyncStates;
typedef vector<pair<condition_variable*, mutex*> > _Notify;
_AsyncStates async_states_;
_Notify notify_;

View File

@@ -1,44 +0,0 @@
macro(pythonize_bool var)
if (${var})
set(${var} True)
else()
set(${var} False)
endif()
endmacro()
include(FindPythonInterp)
if(PYTHONINTERP_FOUND)
set(LIT_EXECUTABLE "" CACHE FILEPATH "Path to LLVM's lit.py.")
set(LIT_ARGS_DEFAULT "-sv")
if (MSVC OR XCODE)
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
endif()
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}"
CACHE STRING "Default options for lit")
set(LIT_ARGS "${LLVM_LIT_ARGS}")
separate_arguments(LIT_ARGS)
set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER})
set(LIBCXX_SOURCE_DIR ${CMAKE_SOURCE_DIR})
set(LIBCXX_BINARY_DIR ${CMAKE_BINARY_DIR})
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
pythonize_bool(LIBCXX_ENABLE_SHARED)
pythonize_bool(LIBCXX_HAS_STDCXX0X_FLAG)
set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
@ONLY)
add_custom_target(libcxx.check
COMMAND ${PYTHON_EXECUTABLE}
${LIT_EXECUTABLE}
${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
COMMENT "Running libcxx tests")
else()
message(WARNING "Could not find Python, no libcxx.check target will be available!")
endif()

View File

@@ -1,19 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// void atomic_signal_fence(memory_order m);
#include <atomic>
int main()
{
std::atomic_signal_fence(std::memory_order_seq_cst);
}

View File

@@ -1,19 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// void atomic_thread_fence(memory_order m);
#include <atomic>
int main()
{
std::atomic_thread_fence(std::memory_order_seq_cst);
}

View File

@@ -1,50 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// #define ATOMIC_CHAR_LOCK_FREE unspecified
// #define ATOMIC_CHAR16_T_LOCK_FREE unspecified
// #define ATOMIC_CHAR32_T_LOCK_FREE unspecified
// #define ATOMIC_WCHAR_T_LOCK_FREE unspecified
// #define ATOMIC_SHORT_LOCK_FREE unspecified
// #define ATOMIC_INT_LOCK_FREE unspecified
// #define ATOMIC_LONG_LOCK_FREE unspecified
// #define ATOMIC_LLONG_LOCK_FREE unspecified
#include <atomic>
#include <cassert>
int main()
{
assert(ATOMIC_CHAR_LOCK_FREE == 0 ||
ATOMIC_CHAR_LOCK_FREE == 1 ||
ATOMIC_CHAR_LOCK_FREE == 2);
assert(ATOMIC_CHAR16_T_LOCK_FREE == 0 ||
ATOMIC_CHAR16_T_LOCK_FREE == 1 ||
ATOMIC_CHAR16_T_LOCK_FREE == 2);
assert(ATOMIC_CHAR32_T_LOCK_FREE == 0 ||
ATOMIC_CHAR32_T_LOCK_FREE == 1 ||
ATOMIC_CHAR32_T_LOCK_FREE == 2);
assert(ATOMIC_WCHAR_T_LOCK_FREE == 0 ||
ATOMIC_WCHAR_T_LOCK_FREE == 1 ||
ATOMIC_WCHAR_T_LOCK_FREE == 2);
assert(ATOMIC_SHORT_LOCK_FREE == 0 ||
ATOMIC_SHORT_LOCK_FREE == 1 ||
ATOMIC_SHORT_LOCK_FREE == 2);
assert(ATOMIC_INT_LOCK_FREE == 0 ||
ATOMIC_INT_LOCK_FREE == 1 ||
ATOMIC_INT_LOCK_FREE == 2);
assert(ATOMIC_LONG_LOCK_FREE == 0 ||
ATOMIC_LONG_LOCK_FREE == 1 ||
ATOMIC_LONG_LOCK_FREE == 2);
assert(ATOMIC_LLONG_LOCK_FREE == 0 ||
ATOMIC_LLONG_LOCK_FREE == 1 ||
ATOMIC_LLONG_LOCK_FREE == 2);
}

View File

@@ -1,126 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// struct atomic<T*>
// {
// bool is_lock_free() const volatile;
// bool is_lock_free() const;
// void store(T* desr, memory_order m = memory_order_seq_cst) volatile;
// void store(T* desr, memory_order m = memory_order_seq_cst);
// T* load(memory_order m = memory_order_seq_cst) const volatile;
// T* load(memory_order m = memory_order_seq_cst) const;
// operator T*() const volatile;
// operator T*() const;
// T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile;
// T* exchange(T* desr, memory_order m = memory_order_seq_cst);
// bool compare_exchange_weak(T*& expc, T* desr,
// memory_order s, memory_order f) volatile;
// bool compare_exchange_weak(T*& expc, T* desr,
// memory_order s, memory_order f);
// bool compare_exchange_strong(T*& expc, T* desr,
// memory_order s, memory_order f) volatile;
// bool compare_exchange_strong(T*& expc, T* desr,
// memory_order s, memory_order f);
// bool compare_exchange_weak(T*& expc, T* desr,
// memory_order m = memory_order_seq_cst) volatile;
// bool compare_exchange_weak(T*& expc, T* desr,
// memory_order m = memory_order_seq_cst);
// bool compare_exchange_strong(T*& expc, T* desr,
// memory_order m = memory_order_seq_cst) volatile;
// bool compare_exchange_strong(T*& expc, T* desr,
// memory_order m = memory_order_seq_cst);
// T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile;
// T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst);
// T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile;
// T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst);
//
// atomic() = default;
// constexpr atomic(T* desr);
// atomic(const atomic&) = delete;
// atomic& operator=(const atomic&) = delete;
// atomic& operator=(const atomic&) volatile = delete;
//
// T* operator=(T*) volatile;
// T* operator=(T*);
// T* operator++(int) volatile;
// T* operator++(int);
// T* operator--(int) volatile;
// T* operator--(int);
// T* operator++() volatile;
// T* operator++();
// T* operator--() volatile;
// T* operator--();
// T* operator+=(ptrdiff_t op) volatile;
// T* operator+=(ptrdiff_t op);
// T* operator-=(ptrdiff_t op) volatile;
// T* operator-=(ptrdiff_t op);
// };
#include <atomic>
#include <cassert>
template <class A, class T>
void
do_test()
{
typedef typename std::remove_pointer<T>::type X;
A obj(T(0));
assert(obj == T(0));
std::atomic_init(&obj, T(1));
assert(obj == T(1));
std::atomic_init(&obj, T(2));
assert(obj == T(2));
bool b0 = obj.is_lock_free();
obj.store(T(0));
assert(obj == T(0));
obj.store(T(1), std::memory_order_release);
assert(obj == T(1));
assert(obj.load() == T(1));
assert(obj.load(std::memory_order_acquire) == T(1));
assert(obj.exchange(T(2)) == T(1));
assert(obj == T(2));
assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
assert(obj == T(3));
T x = obj;
assert(obj.compare_exchange_weak(x, T(2)) == true);
assert(obj == T(2));
assert(x == T(3));
assert(obj.compare_exchange_weak(x, T(1)) == false);
assert(obj == T(2));
assert(x == T(1));
x = T(2);
assert(obj.compare_exchange_strong(x, T(1)) == true);
assert(obj == T(1));
assert(x == T(2));
assert(obj.compare_exchange_strong(x, T(0)) == false);
assert(obj == T(1));
assert(x == T(0));
assert((obj = T(0)) == T(0));
assert(obj == T(0));
obj = T(2*sizeof(X));
assert((obj += std::ptrdiff_t(3)) == T(5*sizeof(X)));
assert(obj == T(5*sizeof(X)));
assert((obj -= std::ptrdiff_t(3)) == T(2*sizeof(X)));
assert(obj == T(2*sizeof(X)));
}
template <class A, class T>
void test()
{
do_test<A, T>();
do_test<volatile A, T>();
}
int main()
{
test<std::atomic<int*>, int*>();
}

View File

@@ -0,0 +1,220 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// typedef struct atomic_address
// {
// bool is_lock_free() const volatile;
// bool is_lock_free() const;
// void store(void*, memory_order = memory_order_seq_cst) volatile;
// void store(void*, memory_order = memory_order_seq_cst);
// void* load(memory_order = memory_order_seq_cst) const volatile;
// void* load(memory_order = memory_order_seq_cst) const;
// operator void*() const volatile;
// operator void*() const;
// void* exchange(void*, memory_order = memory_order_seq_cst) volatile;
// void* exchange(void*, memory_order = memory_order_seq_cst);
// bool compare_exchange_weak(void*&, void*, memory_order,
// memory_order) volatile;
// bool compare_exchange_weak(void*&, void*, memory_order, memory_order);
// bool compare_exchange_strong(void*&, void*, memory_order,
// memory_order) volatile;
// bool compare_exchange_strong(void*&, void*, memory_order, memory_order);
// bool compare_exchange_weak(void*&, void*,
// memory_order = memory_order_seq_cst) volatile;
// bool compare_exchange_weak(void*&, void*,
// memory_order = memory_order_seq_cst);
// bool compare_exchange_strong(void*&, void*,
// memory_order = memory_order_seq_cst) volatile;
// bool compare_exchange_strong(void*&, void*,
// memory_order = memory_order_seq_cst);
// bool compare_exchange_weak(const void*&, const void*,
// memory_order, memory_order) volatile;
// bool compare_exchange_weak(const void*&, const void*, memory_order,
// memory_order);
// bool compare_exchange_strong(const void*&, const void*, memory_order,
// memory_order) volatile;
// bool compare_exchange_strong(const void*&, const void*, memory_order,
// memory_order);
// bool compare_exchange_weak(const void*&, const void*,
// memory_order = memory_order_seq_cst) volatile;
// bool compare_exchange_weak(const void*&, const void*,
// memory_order = memory_order_seq_cst);
// bool compare_exchange_strong(const void*&, const void*,
// memory_order = memory_order_seq_cst) volatile;
// bool compare_exchange_strong(const void*&, const void*,
// memory_order = memory_order_seq_cst);
// void* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
// void* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst);
// void* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
// void* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst);
// atomic_address() = default;
// constexpr atomic_address(void*);
// atomic_address(const atomic_address&) = delete;
// atomic_address& operator=(const atomic_address&) = delete;
// atomic_address& operator=(const atomic_address&) volatile = delete;
// void* operator=(const void*) volatile;
// void* operator=(const void*);
// void* operator+=(ptrdiff_t) volatile;
// void* operator+=(ptrdiff_t);
// void* operator-=(ptrdiff_t) volatile;
// void* operator-=(ptrdiff_t);
// } atomic_address;
//
// bool atomic_is_lock_free(const volatile atomic_address*);
// bool atomic_is_lock_free(const atomic_address*);
// void atomic_init(volatile atomic_address*, void*);
// void atomic_init(atomic_address*, void*);
// void atomic_store(volatile atomic_address*, void*);
// void atomic_store(atomic_address*, void*);
// void atomic_store_explicit(volatile atomic_address*, void*, memory_order);
// void atomic_store_explicit(atomic_address*, void*, memory_order);
// void* atomic_load(const volatile atomic_address*);
// void* atomic_load(const atomic_address*);
// void* atomic_load_explicit(const volatile atomic_address*, memory_order);
// void* atomic_load_explicit(const atomic_address*, memory_order);
// void* atomic_exchange(volatile atomic_address*, void*);
// void* atomic_exchange(atomic_address*, void*);
// void* atomic_exchange_explicit(volatile atomic_address*, void*, memory_order);
// void* atomic_exchange_explicit(atomic_address*, void*, memory_order);
// bool atomic_compare_exchange_weak(volatile atomic_address*, void**, void*);
// bool atomic_compare_exchange_weak(atomic_address*, void**, void*);
// bool atomic_compare_exchange_strong(volatile atomic_address*, void**, void*);
// bool atomic_compare_exchange_strong(atomic_address*, void**, void*);
// bool atomic_compare_exchange_weak_explicit(volatile atomic_address*, void**,
// void*, memory_order, memory_order);
// bool atomic_compare_exchange_weak_explicit(atomic_address*, void**, void*,
// memory_order, memory_order);
// bool atomic_compare_exchange_strong_explicit(volatile atomic_address*, void**,
// void*, memory_order, memory_order);
// bool atomic_compare_exchange_strong_explicit(atomic_address*, void**, void*,
// memory_order, memory_order);
// void* atomic_fetch_add(volatile atomic_address*, ptrdiff_t);
// void* atomic_fetch_add(atomic_address*, ptrdiff_t);
// void* atomic_fetch_add_explicit(volatile atomic_address*, ptrdiff_t,
// memory_order);
// void* atomic_fetch_add_explicit(atomic_address*, ptrdiff_t, memory_order);
// void* atomic_fetch_sub(volatile atomic_address*, ptrdiff_t);
// void* atomic_fetch_sub(atomic_address*, ptrdiff_t);
// void* atomic_fetch_sub_explicit(volatile atomic_address*, ptrdiff_t,
// memory_order);
// void* atomic_fetch_sub_explicit(atomic_address*, ptrdiff_t, memory_order);
#include <atomic>
#include <cassert>
template <class A, class T>
void
do_test()
{
A obj(T(0));
assert(obj == T(0));
std::atomic_init(&obj, T(1));
assert(obj == T(1));
std::atomic_init(&obj, T(2));
assert(obj == T(2));
bool b0 = obj.is_lock_free();
obj.store(T(0));
assert(obj == T(0));
obj.store(T(1), std::memory_order_release);
assert(obj == T(1));
assert(obj.load() == T(1));
assert(obj.load(std::memory_order_acquire) == T(1));
assert(obj.exchange(T(2)) == T(1));
assert(obj == T(2));
assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
assert(obj == T(3));
T x = obj;
assert(obj.compare_exchange_weak(x, T(2)) == true);
assert(obj == T(2));
assert(x == T(3));
assert(obj.compare_exchange_weak(x, T(1)) == false);
assert(obj == T(2));
assert(x == T(2));
assert(obj.compare_exchange_strong(x, T(1)) == true);
assert(obj == T(1));
assert(x == T(2));
assert(obj.compare_exchange_strong(x, T(0)) == false);
assert(obj == T(1));
assert(x == T(1));
assert((obj = T(0)) == T(0));
assert(obj == T(0));
obj = T(2);
assert((obj += std::ptrdiff_t(3)) == T(5));
assert(obj == T(5));
assert((obj -= std::ptrdiff_t(3)) == T(2));
assert(obj == T(2));
std::atomic_init(&obj, T(1));
assert(obj == T(1));
bool b1 = std::atomic_is_lock_free(&obj);
std::atomic_store(&obj, T(0));
assert(obj == T(0));
std::atomic_store_explicit(&obj, T(1), std::memory_order_release);
assert(obj == T(1));
assert(std::atomic_load(&obj) == T(1));
assert(std::atomic_load_explicit(&obj, std::memory_order_acquire) == T(1));
assert(std::atomic_exchange(&obj, T(2)) == T(1));
assert(obj == T(2));
assert(std::atomic_exchange_explicit(&obj, T(3), std::memory_order_relaxed) == T(2));
assert(obj == T(3));
x = obj;
assert(std::atomic_compare_exchange_weak(&obj, &x, T(2)) == true);
assert(obj == T(2));
assert(x == T(3));
assert(std::atomic_compare_exchange_weak(&obj, &x, T(1)) == false);
assert(obj == T(2));
assert(x == T(2));
assert(std::atomic_compare_exchange_strong(&obj, &x, T(1)) == true);
assert(obj == T(1));
assert(x == T(2));
assert(std::atomic_compare_exchange_strong(&obj, &x, T(0)) == false);
assert(obj == T(1));
assert(x == T(1));
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, T(2),
std::memory_order_relaxed, std::memory_order_relaxed) == true);
assert(obj == T(2));
assert(x == T(1));
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, T(3),
std::memory_order_relaxed, std::memory_order_relaxed) == false);
assert(obj == T(2));
assert(x == T(2));
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, T(3),
std::memory_order_relaxed, std::memory_order_relaxed) == true);
assert(obj == T(3));
assert(x == T(2));
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, T(0),
std::memory_order_relaxed, std::memory_order_relaxed) == false);
assert(obj == T(3));
assert(x == T(3));
assert((obj = T(1)) == T(1));
assert(obj == T(1));
obj = T(2);
assert(std::atomic_fetch_add(&obj, std::ptrdiff_t(3)) == T(2));
assert(obj == T(5));
assert(std::atomic_fetch_add_explicit(&obj, std::ptrdiff_t(3), std::memory_order_seq_cst) == T(5));
assert(obj == T(8));
assert(std::atomic_fetch_sub(&obj, std::ptrdiff_t(3)) == T(8));
assert(obj == T(5));
assert(std::atomic_fetch_sub_explicit(&obj, std::ptrdiff_t(3), std::memory_order_seq_cst) == T(5));
assert(obj == T(2));
}
template <class A, class T>
void test()
{
do_test<A, T>();
do_test<volatile A, T>();
}
int main()
{
test<std::atomic_address, void*>();
}

View File

@@ -0,0 +1,239 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// typedef struct atomic_bool
// {
// bool is_lock_free() const volatile;
// bool is_lock_free() const;
// void store(bool, memory_order = memory_order_seq_cst) volatile;
// void store(bool, memory_order = memory_order_seq_cst);
// bool load(memory_order = memory_order_seq_cst) const volatile;
// bool load(memory_order = memory_order_seq_cst) const;
// operator bool() const volatile;
// operator bool() const;
// bool exchange(bool, memory_order = memory_order_seq_cst) volatile;
// bool exchange(bool, memory_order = memory_order_seq_cst);
// bool compare_exchange_weak(bool&, bool, memory_order,
// memory_order) volatile;
// bool compare_exchange_weak(bool&, bool, memory_order, memory_order);
// bool compare_exchange_strong(bool&, bool, memory_order,
// memory_order) volatile;
// bool compare_exchange_strong(bool&, bool, memory_order, memory_order);
// bool compare_exchange_weak(bool&, bool,
// memory_order = memory_order_seq_cst) volatile;
// bool compare_exchange_weak(bool&, bool,
// memory_order = memory_order_seq_cst);
// bool compare_exchange_strong(bool&, bool,
// memory_order = memory_order_seq_cst) volatile;
// bool compare_exchange_strong(bool&, bool,
// memory_order = memory_order_seq_cst);
// atomic_bool() = default;
// constexpr atomic_bool(bool);
// atomic_bool(const atomic_bool&) = delete;
// atomic_bool& operator=(const atomic_bool&) = delete;
// atomic_bool& operator=(const atomic_bool&) volatile = delete;
// bool operator=(bool) volatile;
// bool operator=(bool);
// } atomic_bool;
//
// bool atomic_is_lock_free(const volatile atomic_bool*);
// bool atomic_is_lock_free(const atomic_bool*);
// void atomic_init(volatile atomic_bool*, bool);
// void atomic_init(atomic_bool*, bool);
// void atomic_store(volatile atomic_bool*, bool);
// void atomic_store(atomic_bool*, bool);
// void atomic_store_explicit(volatile atomic_bool*, bool, memory_order);
// void atomic_store_explicit(atomic_bool*, bool, memory_order);
// bool atomic_load(const volatile atomic_bool*);
// bool atomic_load(const atomic_bool*);
// bool atomic_load_explicit(const volatile atomic_bool*, memory_order);
// bool atomic_load_explicit(const atomic_bool*, memory_order);
// bool atomic_exchange(volatile atomic_bool*, bool);
// bool atomic_exchange(atomic_bool*, bool);
// bool atomic_exchange_explicit(volatile atomic_bool*, bool, memory_order);
// bool atomic_exchange_explicit(atomic_bool*, bool, memory_order);
// bool atomic_compare_exchange_weak(volatile atomic_bool*, bool*, bool);
// bool atomic_compare_exchange_weak(atomic_bool*, bool*, bool);
// bool atomic_compare_exchange_strong(volatile atomic_bool*, bool*, bool);
// bool atomic_compare_exchange_strong(atomic_bool*, bool*, bool);
// bool atomic_compare_exchange_weak_explicit(volatile atomic_bool*, bool*, bool,
// memory_order, memory_order);
// bool atomic_compare_exchange_weak_explicit(atomic_bool*, bool*, bool,
// memory_order, memory_order);
// bool atomic_compare_exchange_strong_explicit(volatile atomic_bool*, bool*, bool,
// memory_order, memory_order);
// bool atomic_compare_exchange_strong_explicit(atomic_bool*, bool*, bool,
// memory_order, memory_order);
#include <atomic>
#include <cassert>
int main()
{
{
volatile std::atomic_bool obj(true);
assert(obj == true);
std::atomic_init(&obj, false);
assert(obj == false);
std::atomic_init(&obj, true);
assert(obj == true);
bool b0 = obj.is_lock_free();
obj.store(false);
assert(obj == false);
obj.store(true, std::memory_order_release);
assert(obj == true);
assert(obj.load() == true);
assert(obj.load(std::memory_order_acquire) == true);
assert(obj.exchange(false) == true);
assert(obj == false);
assert(obj.exchange(true, std::memory_order_relaxed) == false);
assert(obj == true);
bool x = obj;
assert(obj.compare_exchange_weak(x, false) == true);
assert(obj == false);
assert(x == true);
assert(obj.compare_exchange_weak(x, true) == false);
assert(obj == false);
assert(x == false);
assert(obj.compare_exchange_strong(x, true) == true);
assert(obj == true);
assert(x == false);
assert(obj.compare_exchange_strong(x, false) == false);
assert(obj == true);
assert(x == true);
assert((obj = false) == false);
assert(obj == false);
std::atomic_init(&obj, true);
assert(obj == true);
bool b1 = std::atomic_is_lock_free(&obj);
std::atomic_store(&obj, false);
assert(obj == false);
std::atomic_store_explicit(&obj, true, std::memory_order_release);
assert(obj == true);
assert(std::atomic_load(&obj) == true);
assert(std::atomic_load_explicit(&obj, std::memory_order_acquire) == true);
assert(std::atomic_exchange(&obj, false) == true);
assert(obj == false);
assert(std::atomic_exchange_explicit(&obj, true, std::memory_order_relaxed) == false);
assert(obj == true);
x = obj;
assert(std::atomic_compare_exchange_weak(&obj, &x, false) == true);
assert(obj == false);
assert(x == true);
assert(std::atomic_compare_exchange_weak(&obj, &x, true) == false);
assert(obj == false);
assert(x == false);
assert(std::atomic_compare_exchange_strong(&obj, &x, true) == true);
assert(obj == true);
assert(x == false);
assert(std::atomic_compare_exchange_strong(&obj, &x, false) == false);
assert(obj == true);
assert(x == true);
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, false,
std::memory_order_relaxed, std::memory_order_relaxed) == true);
assert(obj == false);
assert(x == true);
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, true,
std::memory_order_relaxed, std::memory_order_relaxed) == false);
assert(obj == false);
assert(x == false);
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, true,
std::memory_order_relaxed, std::memory_order_relaxed) == true);
assert(obj == true);
assert(x == false);
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, false,
std::memory_order_relaxed, std::memory_order_relaxed) == false);
assert(obj == true);
assert(x == true);
assert((obj = false) == false);
assert(obj == false);
}
{
std::atomic_bool obj(true);
assert(obj == true);
std::atomic_init(&obj, false);
assert(obj == false);
std::atomic_init(&obj, true);
assert(obj == true);
bool b0 = obj.is_lock_free();
obj.store(false);
assert(obj == false);
obj.store(true, std::memory_order_release);
assert(obj == true);
assert(obj.load() == true);
assert(obj.load(std::memory_order_acquire) == true);
assert(obj.exchange(false) == true);
assert(obj == false);
assert(obj.exchange(true, std::memory_order_relaxed) == false);
assert(obj == true);
bool x = obj;
assert(obj.compare_exchange_weak(x, false) == true);
assert(obj == false);
assert(x == true);
assert(obj.compare_exchange_weak(x, true) == false);
assert(obj == false);
assert(x == false);
assert(obj.compare_exchange_strong(x, true) == true);
assert(obj == true);
assert(x == false);
assert(obj.compare_exchange_strong(x, false) == false);
assert(obj == true);
assert(x == true);
assert((obj = false) == false);
assert(obj == false);
std::atomic_init(&obj, true);
assert(obj == true);
bool b1 = std::atomic_is_lock_free(&obj);
std::atomic_store(&obj, false);
assert(obj == false);
std::atomic_store_explicit(&obj, true, std::memory_order_release);
assert(obj == true);
assert(std::atomic_load(&obj) == true);
assert(std::atomic_load_explicit(&obj, std::memory_order_acquire) == true);
assert(std::atomic_exchange(&obj, false) == true);
assert(obj == false);
assert(std::atomic_exchange_explicit(&obj, true, std::memory_order_relaxed) == false);
assert(obj == true);
x = obj;
assert(std::atomic_compare_exchange_weak(&obj, &x, false) == true);
assert(obj == false);
assert(x == true);
assert(std::atomic_compare_exchange_weak(&obj, &x, true) == false);
assert(obj == false);
assert(x == false);
assert(std::atomic_compare_exchange_strong(&obj, &x, true) == true);
assert(obj == true);
assert(x == false);
assert(std::atomic_compare_exchange_strong(&obj, &x, false) == false);
assert(obj == true);
assert(x == true);
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, false,
std::memory_order_relaxed, std::memory_order_relaxed) == true);
assert(obj == false);
assert(x == true);
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, true,
std::memory_order_relaxed, std::memory_order_relaxed) == false);
assert(obj == false);
assert(x == false);
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, true,
std::memory_order_relaxed, std::memory_order_relaxed) == true);
assert(obj == true);
assert(x == false);
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, false,
std::memory_order_relaxed, std::memory_order_relaxed) == false);
assert(obj == true);
assert(x == true);
assert((obj = false) == false);
assert(obj == false);
}
}

View File

@@ -0,0 +1,276 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// typedef struct atomic_itype
// {
// bool is_lock_free() const volatile;
// bool is_lock_free() const;
// void store(itype, memory_order = memory_order_seq_cst) volatile;
// void store(itype, memory_order = memory_order_seq_cst);
// itype load(memory_order = memory_order_seq_cst) const volatile;
// itype load(memory_order = memory_order_seq_cst) const;
// operator itype() const volatile;
// operator itype() const;
// itype exchange(itype, memory_order = memory_order_seq_cst) volatile;
// itype exchange(itype, memory_order = memory_order_seq_cst);
// bool compare_exchange_weak(itype&, itype, memory_order,
// memory_order) volatile;
// bool compare_exchange_weak(itype&, itype, memory_order, memory_order);
// bool compare_exchange_strong(itype&, itype, memory_order,
// memory_order) volatile;
// bool compare_exchange_strong(itype&, itype, memory_order, memory_order);
// bool compare_exchange_weak(itype&, itype,
// memory_order = memory_order_seq_cst) volatile;
// bool compare_exchange_weak(itype&, itype,
// memory_order = memory_order_seq_cst);
// bool compare_exchange_strong(itype&, itype,
// memory_order = memory_order_seq_cst) volatile;
// bool compare_exchange_strong(itype&, itype,
// memory_order = memory_order_seq_cst);
// itype fetch_add(itype, memory_order = memory_order_seq_cst) volatile;
// itype fetch_add(itype, memory_order = memory_order_seq_cst);
// itype fetch_sub(itype, memory_order = memory_order_seq_cst) volatile;
// itype fetch_sub(itype, memory_order = memory_order_seq_cst);
// itype fetch_and(itype, memory_order = memory_order_seq_cst) volatile;
// itype fetch_and(itype, memory_order = memory_order_seq_cst);
// itype fetch_or(itype, memory_order = memory_order_seq_cst) volatile;
// itype fetch_or(itype, memory_order = memory_order_seq_cst);
// itype fetch_xor(itype, memory_order = memory_order_seq_cst) volatile;
// itype fetch_xor(itype, memory_order = memory_order_seq_cst);
// atomic_itype() = default;
// constexpr atomic_itype(itype);
// atomic_itype(const atomic_itype&) = delete;
// atomic_itype& operator=(const atomic_itype&) = delete;
// atomic_itype& operator=(const atomic_itype&) volatile = delete;
// itype operator=(itype) volatile;
// itype operator=(itype);
// itype operator++(int) volatile;
// itype operator++(int);
// itype operator--(int) volatile;
// itype operator--(int);
// itype operator++() volatile;
// itype operator++();
// itype operator--() volatile;
// itype operator--();
// itype operator+=(itype) volatile;
// itype operator+=(itype);
// itype operator-=(itype) volatile;
// itype operator-=(itype);
// itype operator&=(itype) volatile;
// itype operator&=(itype);
// itype operator|=(itype) volatile;
// itype operator|=(itype);
// itype operator^=(itype) volatile;
// itype operator^=(itype);
// } atomic_itype;
//
// bool atomic_is_lock_free(const volatile atomic_itype*);
// bool atomic_is_lock_free(const atomic_itype*);
// void atomic_init(volatile atomic_itype*, itype);
// void atomic_init(atomic_itype*, itype);
// void atomic_store(volatile atomic_itype*, itype);
// void atomic_store(atomic_itype*, itype);
// void atomic_store_explicit(volatile atomic_itype*, itype, memory_order);
// void atomic_store_explicit(atomic_itype*, itype, memory_order);
// itype atomic_load(const volatile atomic_itype*);
// itype atomic_load(const atomic_itype*);
// itype atomic_load_explicit(const volatile atomic_itype*, memory_order);
// itype atomic_load_explicit(const atomic_itype*, memory_order);
// itype atomic_exchange(volatile atomic_itype*, itype);
// itype atomic_exchange(atomic_itype*, itype);
// itype atomic_exchange_explicit(volatile atomic_itype*, itype, memory_order);
// itype atomic_exchange_explicit(atomic_itype*, itype, memory_order);
// bool atomic_compare_exchange_weak(volatile atomic_itype*, itype*, itype);
// bool atomic_compare_exchange_weak(atomic_itype*, itype*, itype);
// bool atomic_compare_exchange_strong(volatile atomic_itype*, itype*, itype);
// bool atomic_compare_exchange_strong(atomic_itype*, itype*, itype);
// bool atomic_compare_exchange_weak_explicit(volatile atomic_itype*, itype*, itype,
// memory_order, memory_order);
// bool atomic_compare_exchange_weak_explicit(atomic_itype*, itype*, itype,
// memory_order, memory_order);
// bool atomic_compare_exchange_strong_explicit(volatile atomic_itype*, itype*, itype,
// memory_order, memory_order);
// bool atomic_compare_exchange_strong_explicit(atomic_itype*, itype*, itype,
// memory_order, memory_order);
// itype atomic_fetch_add(volatile atomic_itype*, itype);
// itype atomic_fetch_add(atomic_itype*, itype);
// itype atomic_fetch_add_explicit(volatile atomic_itype*, itype, memory_order);
// itype atomic_fetch_add_explicit(atomic_itype*, itype, memory_order);
// itype atomic_fetch_sub(volatile atomic_itype*, itype);
// itype atomic_fetch_sub(atomic_itype*, itype);
// itype atomic_fetch_sub_explicit(volatile atomic_itype*, itype, memory_order);
// itype atomic_fetch_sub_explicit(atomic_itype*, itype, memory_order);
// itype atomic_fetch_and(volatile atomic_itype*, itype);
// itype atomic_fetch_and(atomic_itype*, itype);
// itype atomic_fetch_and_explicit(volatile atomic_itype*, itype, memory_order);
// itype atomic_fetch_and_explicit(atomic_itype*, itype, memory_order);
// itype atomic_fetch_or(volatile atomic_itype*, itype);
// itype atomic_fetch_or(atomic_itype*, itype);
// itype atomic_fetch_or_explicit(volatile atomic_itype*, itype, memory_order);
// itype atomic_fetch_or_explicit(atomic_itype*, itype, memory_order);
// itype atomic_fetch_xor(volatile atomic_itype*, itype);
// itype atomic_fetch_xor(atomic_itype*, itype);
// itype atomic_fetch_xor_explicit(volatile atomic_itype*, itype, memory_order);
// itype atomic_fetch_xor_explicit(atomic_itype*, itype, memory_order);
#include <atomic>
#include <cassert>
template <class A, class T>
void
do_test()
{
A obj(T(0));
assert(obj == T(0));
std::atomic_init(&obj, T(1));
assert(obj == T(1));
std::atomic_init(&obj, T(2));
assert(obj == T(2));
bool b0 = obj.is_lock_free();
obj.store(T(0));
assert(obj == T(0));
obj.store(T(1), std::memory_order_release);
assert(obj == T(1));
assert(obj.load() == T(1));
assert(obj.load(std::memory_order_acquire) == T(1));
assert(obj.exchange(T(2)) == T(1));
assert(obj == T(2));
assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
assert(obj == T(3));
T x = obj;
assert(obj.compare_exchange_weak(x, T(2)) == true);
assert(obj == T(2));
assert(x == T(3));
assert(obj.compare_exchange_weak(x, T(1)) == false);
assert(obj == T(2));
assert(x == T(2));
assert(obj.compare_exchange_strong(x, T(1)) == true);
assert(obj == T(1));
assert(x == T(2));
assert(obj.compare_exchange_strong(x, T(0)) == false);
assert(obj == T(1));
assert(x == T(1));
assert((obj = T(0)) == T(0));
assert(obj == T(0));
assert(obj++ == T(0));
assert(obj == T(1));
assert(++obj == T(2));
assert(obj == T(2));
assert(--obj == T(1));
assert(obj == T(1));
assert(obj-- == T(1));
assert(obj == T(0));
obj = T(2);
assert((obj += T(3)) == T(5));
assert(obj == T(5));
assert((obj -= T(3)) == T(2));
assert(obj == T(2));
assert((obj |= T(5)) == T(7));
assert(obj == T(7));
assert((obj &= T(0xF)) == T(7));
assert(obj == T(7));
assert((obj ^= T(0xF)) == T(8));
assert(obj == T(8));
std::atomic_init(&obj, T(1));
assert(obj == T(1));
bool b1 = std::atomic_is_lock_free(&obj);
std::atomic_store(&obj, T(0));
assert(obj == T(0));
std::atomic_store_explicit(&obj, T(1), std::memory_order_release);
assert(obj == T(1));
assert(std::atomic_load(&obj) == T(1));
assert(std::atomic_load_explicit(&obj, std::memory_order_acquire) == T(1));
assert(std::atomic_exchange(&obj, T(2)) == T(1));
assert(obj == T(2));
assert(std::atomic_exchange_explicit(&obj, T(3), std::memory_order_relaxed) == T(2));
assert(obj == T(3));
x = obj;
assert(std::atomic_compare_exchange_weak(&obj, &x, T(2)) == true);
assert(obj == T(2));
assert(x == T(3));
assert(std::atomic_compare_exchange_weak(&obj, &x, T(1)) == false);
assert(obj == T(2));
assert(x == T(2));
assert(std::atomic_compare_exchange_strong(&obj, &x, T(1)) == true);
assert(obj == T(1));
assert(x == T(2));
assert(std::atomic_compare_exchange_strong(&obj, &x, T(0)) == false);
assert(obj == T(1));
assert(x == T(1));
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, T(2),
std::memory_order_relaxed, std::memory_order_relaxed) == true);
assert(obj == T(2));
assert(x == T(1));
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, T(3),
std::memory_order_relaxed, std::memory_order_relaxed) == false);
assert(obj == T(2));
assert(x == T(2));
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, T(3),
std::memory_order_relaxed, std::memory_order_relaxed) == true);
assert(obj == T(3));
assert(x == T(2));
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, T(0),
std::memory_order_relaxed, std::memory_order_relaxed) == false);
assert(obj == T(3));
assert(x == T(3));
assert((obj = T(1)) == T(1));
assert(obj == T(1));
obj = T(2);
assert(std::atomic_fetch_add(&obj, T(3)) == T(2));
assert(obj == T(5));
assert(std::atomic_fetch_add_explicit(&obj, T(3), std::memory_order_seq_cst) == T(5));
assert(obj == T(8));
assert(std::atomic_fetch_sub(&obj, T(3)) == T(8));
assert(obj == T(5));
assert(std::atomic_fetch_sub_explicit(&obj, T(3), std::memory_order_seq_cst) == T(5));
assert(obj == T(2));
assert(std::atomic_fetch_or(&obj, T(5)) == T(2));
assert(obj == T(7));
assert(std::atomic_fetch_or_explicit(&obj, T(8), std::memory_order_seq_cst) == T(7));
assert(obj == T(0xF));
assert(std::atomic_fetch_and(&obj, T(7)) == T(0xF));
assert(obj == T(7));
assert(std::atomic_fetch_and_explicit(&obj, T(3), std::memory_order_seq_cst) == T(7));
assert(obj == T(3));
assert(std::atomic_fetch_xor(&obj, T(7)) == T(3));
assert(obj == T(4));
assert(std::atomic_fetch_xor_explicit(&obj, T(7), std::memory_order_seq_cst) == T(4));
assert(obj == T(3));
}
template <class A, class T>
void test()
{
do_test<A, T>();
do_test<volatile A, T>();
}
int main()
{
test<std::atomic_char, char>();
test<std::atomic_schar, signed char>();
test<std::atomic_uchar, unsigned char>();
test<std::atomic_short, short>();
test<std::atomic_ushort, unsigned short>();
test<std::atomic_int, int>();
test<std::atomic_uint, unsigned int>();
test<std::atomic_long, long>();
test<std::atomic_ulong, unsigned long>();
test<std::atomic_llong, long long>();
test<std::atomic_ullong, unsigned long long>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<std::atomic_char16_t, char16_t>();
test<std::atomic_char32_t, char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<std::atomic_wchar_t, wchar_t>();
}

View File

@@ -1,163 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// struct atomic
// {
// bool is_lock_free() const volatile;
// bool is_lock_free() const;
// void store(T desr, memory_order m = memory_order_seq_cst) volatile;
// void store(T desr, memory_order m = memory_order_seq_cst);
// T load(memory_order m = memory_order_seq_cst) const volatile;
// T load(memory_order m = memory_order_seq_cst) const;
// operator T() const volatile;
// operator T() const;
// T exchange(T desr, memory_order m = memory_order_seq_cst) volatile;
// T exchange(T desr, memory_order m = memory_order_seq_cst);
// bool compare_exchange_weak(T& expc, T desr,
// memory_order s, memory_order f) volatile;
// bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f);
// bool compare_exchange_strong(T& expc, T desr,
// memory_order s, memory_order f) volatile;
// bool compare_exchange_strong(T& expc, T desr,
// memory_order s, memory_order f);
// bool compare_exchange_weak(T& expc, T desr,
// memory_order m = memory_order_seq_cst) volatile;
// bool compare_exchange_weak(T& expc, T desr,
// memory_order m = memory_order_seq_cst);
// bool compare_exchange_strong(T& expc, T desr,
// memory_order m = memory_order_seq_cst) volatile;
// bool compare_exchange_strong(T& expc, T desr,
// memory_order m = memory_order_seq_cst);
//
// atomic() = default;
// constexpr atomic(T desr);
// atomic(const atomic&) = delete;
// atomic& operator=(const atomic&) = delete;
// atomic& operator=(const atomic&) volatile = delete;
// T operator=(T) volatile;
// T operator=(T);
// };
#include <atomic>
#include <cassert>
int main()
{
{
volatile std::atomic<bool> _;
volatile std::atomic<bool> obj(true);
assert(obj == true);
std::atomic_init(&obj, false);
assert(obj == false);
std::atomic_init(&obj, true);
assert(obj == true);
bool b0 = obj.is_lock_free();
obj.store(false);
assert(obj == false);
obj.store(true, std::memory_order_release);
assert(obj == true);
assert(obj.load() == true);
assert(obj.load(std::memory_order_acquire) == true);
assert(obj.exchange(false) == true);
assert(obj == false);
assert(obj.exchange(true, std::memory_order_relaxed) == false);
assert(obj == true);
bool x = obj;
assert(obj.compare_exchange_weak(x, false) == true);
assert(obj == false);
assert(x == true);
assert(obj.compare_exchange_weak(x, true,
std::memory_order_seq_cst) == false);
assert(obj == false);
assert(x == true);
obj.store(true);
assert(obj.compare_exchange_weak(x, false,
std::memory_order_seq_cst,
std::memory_order_seq_cst) == true);
assert(obj == false);
assert(x == true);
x = true;
obj.store(true);
assert(obj.compare_exchange_strong(x, false) == true);
assert(obj == false);
assert(x == true);
assert(obj.compare_exchange_strong(x, true,
std::memory_order_seq_cst) == false);
assert(obj == false);
assert(x == true);
x = true;
obj.store(true);
assert(obj.compare_exchange_strong(x, false,
std::memory_order_seq_cst,
std::memory_order_seq_cst) == true);
assert(obj == false);
assert(x == true);
assert((obj = false) == false);
assert(obj == false);
assert((obj = true) == true);
assert(obj == true);
}
{
std::atomic<bool> _;
std::atomic<bool> obj(true);
assert(obj == true);
std::atomic_init(&obj, false);
assert(obj == false);
std::atomic_init(&obj, true);
assert(obj == true);
bool b0 = obj.is_lock_free();
obj.store(false);
assert(obj == false);
obj.store(true, std::memory_order_release);
assert(obj == true);
assert(obj.load() == true);
assert(obj.load(std::memory_order_acquire) == true);
assert(obj.exchange(false) == true);
assert(obj == false);
assert(obj.exchange(true, std::memory_order_relaxed) == false);
assert(obj == true);
bool x = obj;
assert(obj.compare_exchange_weak(x, false) == true);
assert(obj == false);
assert(x == true);
assert(obj.compare_exchange_weak(x, true,
std::memory_order_seq_cst) == false);
assert(obj == false);
assert(x == true);
obj.store(true);
assert(obj.compare_exchange_weak(x, false,
std::memory_order_seq_cst,
std::memory_order_seq_cst) == true);
assert(obj == false);
assert(x == true);
x = true;
obj.store(true);
assert(obj.compare_exchange_strong(x, false) == true);
assert(obj == false);
assert(x == true);
assert(obj.compare_exchange_strong(x, true,
std::memory_order_seq_cst) == false);
assert(obj == false);
assert(x == true);
x = true;
obj.store(true);
assert(obj.compare_exchange_strong(x, false,
std::memory_order_seq_cst,
std::memory_order_seq_cst) == true);
assert(obj == false);
assert(x == true);
assert((obj = false) == false);
assert(obj == false);
assert((obj = true) == true);
assert(obj == true);
}
}

View File

@@ -1,66 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// typedef atomic<int_least8_t> atomic_int_least8_t;
// typedef atomic<uint_least8_t> atomic_uint_least8_t;
// typedef atomic<int_least16_t> atomic_int_least16_t;
// typedef atomic<uint_least16_t> atomic_uint_least16_t;
// typedef atomic<int_least32_t> atomic_int_least32_t;
// typedef atomic<uint_least32_t> atomic_uint_least32_t;
// typedef atomic<int_least64_t> atomic_int_least64_t;
// typedef atomic<uint_least64_t> atomic_uint_least64_t;
//
// typedef atomic<int_fast8_t> atomic_int_fast8_t;
// typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
// typedef atomic<int_fast16_t> atomic_int_fast16_t;
// typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
// typedef atomic<int_fast32_t> atomic_int_fast32_t;
// typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
// typedef atomic<int_fast64_t> atomic_int_fast64_t;
// typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
//
// typedef atomic<intptr_t> atomic_intptr_t;
// typedef atomic<uintptr_t> atomic_uintptr_t;
// typedef atomic<size_t> atomic_size_t;
// typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
// typedef atomic<intmax_t> atomic_intmax_t;
// typedef atomic<uintmax_t> atomic_uintmax_t;
#include <atomic>
#include <type_traits>
int main()
{
static_assert((std::is_same<std::atomic< std::int_least8_t>, std::atomic_int_least8_t>::value), "");
static_assert((std::is_same<std::atomic< std::uint_least8_t>, std::atomic_uint_least8_t>::value), "");
static_assert((std::is_same<std::atomic< std::int_least16_t>, std::atomic_int_least16_t>::value), "");
static_assert((std::is_same<std::atomic<std::uint_least16_t>, std::atomic_uint_least16_t>::value), "");
static_assert((std::is_same<std::atomic< std::int_least32_t>, std::atomic_int_least32_t>::value), "");
static_assert((std::is_same<std::atomic<std::uint_least32_t>, std::atomic_uint_least32_t>::value), "");
static_assert((std::is_same<std::atomic< std::int_least64_t>, std::atomic_int_least64_t>::value), "");
static_assert((std::is_same<std::atomic<std::uint_least64_t>, std::atomic_uint_least64_t>::value), "");
static_assert((std::is_same<std::atomic< std::int_fast8_t>, std::atomic_int_fast8_t>::value), "");
static_assert((std::is_same<std::atomic< std::uint_fast8_t>, std::atomic_uint_fast8_t>::value), "");
static_assert((std::is_same<std::atomic< std::int_fast16_t>, std::atomic_int_fast16_t>::value), "");
static_assert((std::is_same<std::atomic<std::uint_fast16_t>, std::atomic_uint_fast16_t>::value), "");
static_assert((std::is_same<std::atomic< std::int_fast32_t>, std::atomic_int_fast32_t>::value), "");
static_assert((std::is_same<std::atomic<std::uint_fast32_t>, std::atomic_uint_fast32_t>::value), "");
static_assert((std::is_same<std::atomic< std::int_fast64_t>, std::atomic_int_fast64_t>::value), "");
static_assert((std::is_same<std::atomic<std::uint_fast64_t>, std::atomic_uint_fast64_t>::value), "");
static_assert((std::is_same<std::atomic< std::intptr_t>, std::atomic_intptr_t>::value), "");
static_assert((std::is_same<std::atomic<std::uintptr_t>, std::atomic_uintptr_t>::value), "");
static_assert((std::is_same<std::atomic< std::size_t>, std::atomic_size_t>::value), "");
static_assert((std::is_same<std::atomic<std::ptrdiff_t>, std::atomic_ptrdiff_t>::value), "");
static_assert((std::is_same<std::atomic< std::intmax_t>, std::atomic_intmax_t>::value), "");
static_assert((std::is_same<std::atomic<std::uintmax_t>, std::atomic_uintmax_t>::value), "");
}

View File

@@ -1,191 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <>
// struct atomic<integral>
// {
// bool is_lock_free() const volatile;
// bool is_lock_free() const;
// void store(integral desr, memory_order m = memory_order_seq_cst) volatile;
// void store(integral desr, memory_order m = memory_order_seq_cst);
// integral load(memory_order m = memory_order_seq_cst) const volatile;
// integral load(memory_order m = memory_order_seq_cst) const;
// operator integral() const volatile;
// operator integral() const;
// integral exchange(integral desr,
// memory_order m = memory_order_seq_cst) volatile;
// integral exchange(integral desr, memory_order m = memory_order_seq_cst);
// bool compare_exchange_weak(integral& expc, integral desr,
// memory_order s, memory_order f) volatile;
// bool compare_exchange_weak(integral& expc, integral desr,
// memory_order s, memory_order f);
// bool compare_exchange_strong(integral& expc, integral desr,
// memory_order s, memory_order f) volatile;
// bool compare_exchange_strong(integral& expc, integral desr,
// memory_order s, memory_order f);
// bool compare_exchange_weak(integral& expc, integral desr,
// memory_order m = memory_order_seq_cst) volatile;
// bool compare_exchange_weak(integral& expc, integral desr,
// memory_order m = memory_order_seq_cst);
// bool compare_exchange_strong(integral& expc, integral desr,
// memory_order m = memory_order_seq_cst) volatile;
// bool compare_exchange_strong(integral& expc, integral desr,
// memory_order m = memory_order_seq_cst);
//
// integral
// fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile;
// integral fetch_add(integral op, memory_order m = memory_order_seq_cst);
// integral
// fetch_sub(integral op, memory_order m = memory_order_seq_cst) volatile;
// integral fetch_sub(integral op, memory_order m = memory_order_seq_cst);
// integral
// fetch_and(integral op, memory_order m = memory_order_seq_cst) volatile;
// integral fetch_and(integral op, memory_order m = memory_order_seq_cst);
// integral
// fetch_or(integral op, memory_order m = memory_order_seq_cst) volatile;
// integral fetch_or(integral op, memory_order m = memory_order_seq_cst);
// integral
// fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile;
// integral fetch_xor(integral op, memory_order m = memory_order_seq_cst);
//
// atomic() = default;
// constexpr atomic(integral desr);
// atomic(const atomic&) = delete;
// atomic& operator=(const atomic&) = delete;
// atomic& operator=(const atomic&) volatile = delete;
// integral operator=(integral desr) volatile;
// integral operator=(integral desr);
//
// integral operator++(int) volatile;
// integral operator++(int);
// integral operator--(int) volatile;
// integral operator--(int);
// integral operator++() volatile;
// integral operator++();
// integral operator--() volatile;
// integral operator--();
// integral operator+=(integral op) volatile;
// integral operator+=(integral op);
// integral operator-=(integral op) volatile;
// integral operator-=(integral op);
// integral operator&=(integral op) volatile;
// integral operator&=(integral op);
// integral operator|=(integral op) volatile;
// integral operator|=(integral op);
// integral operator^=(integral op) volatile;
// integral operator^=(integral op);
// };
#include <atomic>
#include <cassert>
template <class A, class T>
void
do_test()
{
A obj(T(0));
assert(obj == T(0));
std::atomic_init(&obj, T(1));
assert(obj == T(1));
std::atomic_init(&obj, T(2));
assert(obj == T(2));
bool b0 = obj.is_lock_free();
obj.store(T(0));
assert(obj == T(0));
obj.store(T(1), std::memory_order_release);
assert(obj == T(1));
assert(obj.load() == T(1));
assert(obj.load(std::memory_order_acquire) == T(1));
assert(obj.exchange(T(2)) == T(1));
assert(obj == T(2));
assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
assert(obj == T(3));
T x = obj;
assert(obj.compare_exchange_weak(x, T(2)) == true);
assert(obj == T(2));
assert(x == T(3));
assert(obj.compare_exchange_weak(x, T(1)) == false);
assert(obj == T(2));
assert(x == T(1));
x = T(2);
assert(obj.compare_exchange_strong(x, T(1)) == true);
assert(obj == T(1));
assert(x == T(2));
assert(obj.compare_exchange_strong(x, T(0)) == false);
assert(obj == T(1));
assert(x == T(0));
assert((obj = T(0)) == T(0));
assert(obj == T(0));
assert(obj++ == T(0));
assert(obj == T(1));
assert(++obj == T(2));
assert(obj == T(2));
assert(--obj == T(1));
assert(obj == T(1));
assert(obj-- == T(1));
assert(obj == T(0));
obj = T(2);
assert((obj += T(3)) == T(5));
assert(obj == T(5));
assert((obj -= T(3)) == T(2));
assert(obj == T(2));
assert((obj |= T(5)) == T(7));
assert(obj == T(7));
assert((obj &= T(0xF)) == T(7));
assert(obj == T(7));
assert((obj ^= T(0xF)) == T(8));
assert(obj == T(8));
}
template <class A, class T>
void test()
{
do_test<A, T>();
do_test<volatile A, T>();
}
int main()
{
test<std::atomic_char, char>();
test<std::atomic_schar, signed char>();
test<std::atomic_uchar, unsigned char>();
test<std::atomic_short, short>();
test<std::atomic_ushort, unsigned short>();
test<std::atomic_int, int>();
test<std::atomic_uint, unsigned int>();
test<std::atomic_long, long>();
test<std::atomic_ulong, unsigned long>();
test<std::atomic_llong, long long>();
test<std::atomic_ullong, unsigned long long>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<std::atomic_char16_t, char16_t>();
test<std::atomic_char32_t, char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<std::atomic_wchar_t, wchar_t>();
test<volatile std::atomic_char, char>();
test<volatile std::atomic_schar, signed char>();
test<volatile std::atomic_uchar, unsigned char>();
test<volatile std::atomic_short, short>();
test<volatile std::atomic_ushort, unsigned short>();
test<volatile std::atomic_int, int>();
test<volatile std::atomic_uint, unsigned int>();
test<volatile std::atomic_long, long>();
test<volatile std::atomic_ulong, unsigned long>();
test<volatile std::atomic_llong, long long>();
test<volatile std::atomic_ullong, unsigned long long>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<volatile std::atomic_char16_t, char16_t>();
test<volatile std::atomic_char32_t, char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<volatile std::atomic_wchar_t, wchar_t>();
}

View File

@@ -1,48 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// typedef atomic<char> atomic_char;
// typedef atomic<signed char> atomic_schar;
// typedef atomic<unsigned char> atomic_uchar;
// typedef atomic<short> atomic_short;
// typedef atomic<unsigned short> atomic_ushort;
// typedef atomic<int> atomic_int;
// typedef atomic<unsigned int> atomic_uint;
// typedef atomic<long> atomic_long;
// typedef atomic<unsigned long> atomic_ulong;
// typedef atomic<long long> atomic_llong;
// typedef atomic<unsigned long long> atomic_ullong;
// typedef atomic<char16_t> atomic_char16_t;
// typedef atomic<char32_t> atomic_char32_t;
// typedef atomic<wchar_t> atomic_wchar_t;
#include <atomic>
#include <type_traits>
int main()
{
static_assert((std::is_same<std::atomic<char>, std::atomic_char>::value), "");
static_assert((std::is_same<std::atomic<signed char>, std::atomic_schar>::value), "");
static_assert((std::is_same<std::atomic<unsigned char>, std::atomic_uchar>::value), "");
static_assert((std::is_same<std::atomic<short>, std::atomic_short>::value), "");
static_assert((std::is_same<std::atomic<unsigned short>, std::atomic_ushort>::value), "");
static_assert((std::is_same<std::atomic<int>, std::atomic_int>::value), "");
static_assert((std::is_same<std::atomic<unsigned int>, std::atomic_uint>::value), "");
static_assert((std::is_same<std::atomic<long>, std::atomic_long>::value), "");
static_assert((std::is_same<std::atomic<unsigned long>, std::atomic_ulong>::value), "");
static_assert((std::is_same<std::atomic<long long>, std::atomic_llong>::value), "");
static_assert((std::is_same<std::atomic<unsigned long long>, std::atomic_ullong>::value), "");
static_assert((std::is_same<std::atomic<wchar_t>, std::atomic_wchar_t>::value), "");
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
static_assert((std::is_same<std::atomic<char16_t>, std::atomic_char16_t>::value), "");
static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), "");
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
}

View File

@@ -1,13 +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.
//
//===----------------------------------------------------------------------===//
int main()
{
}

View File

@@ -1,13 +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.
//
//===----------------------------------------------------------------------===//
int main()
{
}

View File

@@ -1,88 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// bool
// atomic_compare_exchange_strong(volatile atomic<T>* obj, T* expc, T desr);
//
// template <class T>
// bool
// atomic_compare_exchange_strong(atomic<T>* obj, T* expc, T desr);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A a;
T t(T(1));
std::atomic_init(&a, t);
assert(std::atomic_compare_exchange_strong(&a, &t, T(2)) == true);
assert(a == T(2));
assert(t == T(1));
assert(std::atomic_compare_exchange_strong(&a, &t, T(3)) == false);
assert(a == T(2));
assert(t == T(3));
}
{
typedef std::atomic<T> A;
volatile A a;
T t(T(1));
std::atomic_init(&a, t);
assert(std::atomic_compare_exchange_strong(&a, &t, T(2)) == true);
assert(a == T(2));
assert(t == T(1));
assert(std::atomic_compare_exchange_strong(&a, &t, T(3)) == false);
assert(a == T(2));
assert(t == T(3));
}
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,95 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// bool
// atomic_compare_exchange_strong_explicit(volatile atomic<T>* obj, T* expc,
// T desr,
// memory_order s, memory_order f);
//
// template <class T>
// bool
// atomic_compare_exchange_strong_explicit(atomic<T>* obj, T* expc, T desr,
// memory_order s, memory_order f);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A a;
T t(T(1));
std::atomic_init(&a, t);
assert(std::atomic_compare_exchange_strong_explicit(&a, &t, T(2),
std::memory_order_seq_cst, std::memory_order_seq_cst) == true);
assert(a == T(2));
assert(t == T(1));
assert(std::atomic_compare_exchange_strong_explicit(&a, &t, T(3),
std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
assert(a == T(2));
assert(t == T(3));
}
{
typedef std::atomic<T> A;
volatile A a;
T t(T(1));
std::atomic_init(&a, t);
assert(std::atomic_compare_exchange_strong_explicit(&a, &t, T(2),
std::memory_order_seq_cst, std::memory_order_seq_cst) == true);
assert(a == T(2));
assert(t == T(1));
assert(std::atomic_compare_exchange_strong_explicit(&a, &t, T(3),
std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
assert(a == T(2));
assert(t == T(3));
}
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,88 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// bool
// atomic_compare_exchange_weak(volatile atomic<T>* obj, T* expc, T desr);
//
// template <class T>
// bool
// atomic_compare_exchange_weak(atomic<T>* obj, T* expc, T desr);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A a;
T t(T(1));
std::atomic_init(&a, t);
assert(std::atomic_compare_exchange_weak(&a, &t, T(2)) == true);
assert(a == T(2));
assert(t == T(1));
assert(std::atomic_compare_exchange_weak(&a, &t, T(3)) == false);
assert(a == T(2));
assert(t == T(3));
}
{
typedef std::atomic<T> A;
volatile A a;
T t(T(1));
std::atomic_init(&a, t);
assert(std::atomic_compare_exchange_weak(&a, &t, T(2)) == true);
assert(a == T(2));
assert(t == T(1));
assert(std::atomic_compare_exchange_weak(&a, &t, T(3)) == false);
assert(a == T(2));
assert(t == T(3));
}
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,95 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// bool
// atomic_compare_exchange_weak_explicit(volatile atomic<T>* obj, T* expc,
// T desr,
// memory_order s, memory_order f);
//
// template <class T>
// bool
// atomic_compare_exchange_weak_explicit(atomic<T>* obj, T* expc, T desr,
// memory_order s, memory_order f);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A a;
T t(T(1));
std::atomic_init(&a, t);
assert(std::atomic_compare_exchange_weak_explicit(&a, &t, T(2),
std::memory_order_seq_cst, std::memory_order_seq_cst) == true);
assert(a == T(2));
assert(t == T(1));
assert(std::atomic_compare_exchange_weak_explicit(&a, &t, T(3),
std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
assert(a == T(2));
assert(t == T(3));
}
{
typedef std::atomic<T> A;
volatile A a;
T t(T(1));
std::atomic_init(&a, t);
assert(std::atomic_compare_exchange_weak_explicit(&a, &t, T(2),
std::memory_order_seq_cst, std::memory_order_seq_cst) == true);
assert(a == T(2));
assert(t == T(1));
assert(std::atomic_compare_exchange_weak_explicit(&a, &t, T(3),
std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
assert(a == T(2));
assert(t == T(3));
}
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,73 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// T
// atomic_exchange(volatile atomic<T>* obj, T desr);
//
// template <class T>
// T
// atomic_exchange(atomic<T>* obj, T desr);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_exchange(&t, T(2)) == T(1));
assert(t == T(2));
volatile A vt;
std::atomic_init(&vt, T(3));
assert(std::atomic_exchange(&vt, T(4)) == T(3));
assert(vt == T(4));
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,75 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// T
// atomic_exchange_explicit(volatile atomic<T>* obj, T desr, memory_order m);
//
// template <class T>
// T
// atomic_exchange_explicit(atomic<T>* obj, T desr, memory_order m);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_exchange_explicit(&t, T(2), std::memory_order_seq_cst)
== T(1));
assert(t == T(2));
volatile A vt;
std::atomic_init(&vt, T(3));
assert(std::atomic_exchange_explicit(&vt, T(4), std::memory_order_seq_cst)
== T(3));
assert(vt == T(4));
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,107 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class Integral>
// Integral
// atomic_fetch_add(volatile atomic<Integral>* obj, Integral op);
//
// template <class Integral>
// Integral
// atomic_fetch_add(atomic<Integral>* obj, Integral op);
//
// template <class T>
// T*
// atomic_fetch_add(volatile atomic<T*>* obj, ptrdiff_t op);
//
// template <class T>
// T*
// atomic_fetch_add(atomic<T*>* obj, ptrdiff_t op);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_fetch_add(&t, T(2)) == T(1));
assert(t == T(3));
}
{
typedef std::atomic<T> A;
volatile A t;
std::atomic_init(&t, T(1));
assert(std::atomic_fetch_add(&t, T(2)) == T(1));
assert(t == T(3));
}
}
template <class T>
void
testp()
{
{
typedef std::atomic<T> A;
typedef typename std::remove_pointer<T>::type X;
A t;
std::atomic_init(&t, T(1*sizeof(X)));
assert(std::atomic_fetch_add(&t, 2) == T(1*sizeof(X)));
assert(t == T(3*sizeof(X)));
}
{
typedef std::atomic<T> A;
typedef typename std::remove_pointer<T>::type X;
volatile A t;
std::atomic_init(&t, T(1*sizeof(X)));
assert(std::atomic_fetch_add(&t, 2) == T(1*sizeof(X)));
assert(t == T(3*sizeof(X)));
}
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
testp<int*>();
testp<const int*>();
}

View File

@@ -1,111 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class Integral>
// Integral
// atomic_fetch_add_explicit(volatile atomic<Integral>* obj, Integral op,
// memory_order m);
// template <class Integral>
// Integral
// atomic_fetch_add_explicit(atomic<Integral>* obj, Integral op,
// memory_order m);
// template <class T>
// T*
// atomic_fetch_add_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
// memory_order m);
// template <class T>
// T*
// atomic_fetch_add_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_fetch_add_explicit(&t, T(2),
std::memory_order_seq_cst) == T(1));
assert(t == T(3));
}
{
typedef std::atomic<T> A;
volatile A t;
std::atomic_init(&t, T(1));
assert(std::atomic_fetch_add_explicit(&t, T(2),
std::memory_order_seq_cst) == T(1));
assert(t == T(3));
}
}
template <class T>
void
testp()
{
{
typedef std::atomic<T> A;
typedef typename std::remove_pointer<T>::type X;
A t;
std::atomic_init(&t, T(1*sizeof(X)));
assert(std::atomic_fetch_add_explicit(&t, 2,
std::memory_order_seq_cst) == T(1*sizeof(X)));
assert(t == T(3*sizeof(X)));
}
{
typedef std::atomic<T> A;
typedef typename std::remove_pointer<T>::type X;
volatile A t;
std::atomic_init(&t, T(1*sizeof(X)));
assert(std::atomic_fetch_add_explicit(&t, 2,
std::memory_order_seq_cst) == T(1*sizeof(X)));
assert(t == T(3*sizeof(X)));
}
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
testp<int*>();
testp<const int*>();
}

View File

@@ -1,61 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class Integral>
// Integral
// atomic_fetch_and(volatile atomic<Integral>* obj, Integral op);
//
// template <class Integral>
// Integral
// atomic_fetch_and(atomic<Integral>* obj, Integral op);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_fetch_and(&t, T(2)) == T(1));
assert(t == T(0));
}
{
typedef std::atomic<T> A;
volatile A t;
std::atomic_init(&t, T(3));
assert(std::atomic_fetch_and(&t, T(2)) == T(3));
assert(t == T(2));
}
}
int main()
{
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
}

View File

@@ -1,63 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class Integral>
// Integral
// atomic_fetch_and_explicit(volatile atomic<Integral>* obj, Integral op);
//
// template <class Integral>
// Integral
// atomic_fetch_and_explicit(atomic<Integral>* obj, Integral op);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_fetch_and_explicit(&t, T(2),
std::memory_order_seq_cst) == T(1));
assert(t == T(0));
}
{
typedef std::atomic<T> A;
volatile A t;
std::atomic_init(&t, T(3));
assert(std::atomic_fetch_and_explicit(&t, T(2),
std::memory_order_seq_cst) == T(3));
assert(t == T(2));
}
}
int main()
{
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
}

View File

@@ -1,61 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class Integral>
// Integral
// atomic_fetch_or(volatile atomic<Integral>* obj, Integral op);
//
// template <class Integral>
// Integral
// atomic_fetch_or(atomic<Integral>* obj, Integral op);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_fetch_or(&t, T(2)) == T(1));
assert(t == T(3));
}
{
typedef std::atomic<T> A;
volatile A t;
std::atomic_init(&t, T(3));
assert(std::atomic_fetch_or(&t, T(2)) == T(3));
assert(t == T(3));
}
}
int main()
{
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
}

View File

@@ -1,63 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class Integral>
// Integral
// atomic_fetch_or_explicit(volatile atomic<Integral>* obj, Integral op);
//
// template <class Integral>
// Integral
// atomic_fetch_or_explicit(atomic<Integral>* obj, Integral op);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_fetch_or_explicit(&t, T(2),
std::memory_order_seq_cst) == T(1));
assert(t == T(3));
}
{
typedef std::atomic<T> A;
volatile A t;
std::atomic_init(&t, T(3));
assert(std::atomic_fetch_or_explicit(&t, T(2),
std::memory_order_seq_cst) == T(3));
assert(t == T(3));
}
}
int main()
{
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
}

View File

@@ -1,107 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class Integral>
// Integral
// atomic_fetch_sub(volatile atomic<Integral>* obj, Integral op);
//
// template <class Integral>
// Integral
// atomic_fetch_sub(atomic<Integral>* obj, Integral op);
//
// template <class T>
// T*
// atomic_fetch_sub(volatile atomic<T*>* obj, ptrdiff_t op);
//
// template <class T>
// T*
// atomic_fetch_sub(atomic<T*>* obj, ptrdiff_t op);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(3));
assert(std::atomic_fetch_sub(&t, T(2)) == T(3));
assert(t == T(1));
}
{
typedef std::atomic<T> A;
volatile A t;
std::atomic_init(&t, T(3));
assert(std::atomic_fetch_sub(&t, T(2)) == T(3));
assert(t == T(1));
}
}
template <class T>
void
testp()
{
{
typedef std::atomic<T> A;
typedef typename std::remove_pointer<T>::type X;
A t;
std::atomic_init(&t, T(3*sizeof(X)));
assert(std::atomic_fetch_sub(&t, 2) == T(3*sizeof(X)));
assert(t == T(1*sizeof(X)));
}
{
typedef std::atomic<T> A;
typedef typename std::remove_pointer<T>::type X;
volatile A t;
std::atomic_init(&t, T(3*sizeof(X)));
assert(std::atomic_fetch_sub(&t, 2) == T(3*sizeof(X)));
assert(t == T(1*sizeof(X)));
}
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
testp<int*>();
testp<const int*>();
}

View File

@@ -1,112 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class Integral>
// Integral
// atomic_fetch_sub_explicit(volatile atomic<Integral>* obj, Integral op,
// memory_order m);
// template <class Integral>
// Integral
// atomic_fetch_sub_explicit(atomic<Integral>* obj, Integral op,
// memory_order m);
//
// template <class T>
// T*
// atomic_fetch_sub_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
// memory_order m);
// template <class T>
// T*
// atomic_fetch_sub_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(3));
assert(std::atomic_fetch_sub_explicit(&t, T(2),
std::memory_order_seq_cst) == T(3));
assert(t == T(1));
}
{
typedef std::atomic<T> A;
volatile A t;
std::atomic_init(&t, T(3));
assert(std::atomic_fetch_sub_explicit(&t, T(2),
std::memory_order_seq_cst) == T(3));
assert(t == T(1));
}
}
template <class T>
void
testp()
{
{
typedef std::atomic<T> A;
typedef typename std::remove_pointer<T>::type X;
A t;
std::atomic_init(&t, T(3*sizeof(X)));
assert(std::atomic_fetch_sub_explicit(&t, 2,
std::memory_order_seq_cst) == T(3*sizeof(X)));
assert(t == T(1*sizeof(X)));
}
{
typedef std::atomic<T> A;
typedef typename std::remove_pointer<T>::type X;
volatile A t;
std::atomic_init(&t, T(3*sizeof(X)));
assert(std::atomic_fetch_sub_explicit(&t, 2,
std::memory_order_seq_cst) == T(3*sizeof(X)));
assert(t == T(1*sizeof(X)));
}
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
testp<int*>();
testp<const int*>();
}

View File

@@ -1,61 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class Integral>
// Integral
// atomic_fetch_xor(volatile atomic<Integral>* obj, Integral op);
//
// template <class Integral>
// Integral
// atomic_fetch_xor(atomic<Integral>* obj, Integral op);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_fetch_xor(&t, T(2)) == T(1));
assert(t == T(3));
}
{
typedef std::atomic<T> A;
volatile A t;
std::atomic_init(&t, T(3));
assert(std::atomic_fetch_xor(&t, T(2)) == T(3));
assert(t == T(1));
}
}
int main()
{
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
}

View File

@@ -1,63 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class Integral>
// Integral
// atomic_fetch_xor_explicit(volatile atomic<Integral>* obj, Integral op);
//
// template <class Integral>
// Integral
// atomic_fetch_xor_explicit(atomic<Integral>* obj, Integral op);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_fetch_xor_explicit(&t, T(2),
std::memory_order_seq_cst) == T(1));
assert(t == T(3));
}
{
typedef std::atomic<T> A;
volatile A t;
std::atomic_init(&t, T(3));
assert(std::atomic_fetch_xor_explicit(&t, T(2),
std::memory_order_seq_cst) == T(3));
assert(t == T(1));
}
}
int main()
{
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
}

View File

@@ -1,71 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// void
// atomic_init(volatile atomic<T>* obj, T desr);
//
// template <class T>
// void
// atomic_init(atomic<T>* obj, T desr);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(t == T(1));
volatile A vt;
std::atomic_init(&vt, T(2));
assert(vt == T(2));
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,59 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// bool
// atomic_is_lock_free(const volatile atomic<T>* obj);
//
// template <class T>
// bool
// atomic_is_lock_free(const atomic<T>* obj);
#include <atomic>
template <class T>
void
test()
{
typedef std::atomic<T> A;
const A ct;
bool b1 = std::atomic_is_lock_free(&ct);
const volatile A cvt;
bool b2 = std::atomic_is_lock_free(&cvt);
}
struct A
{
char _[4];
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,71 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// T
// atomic_load(const volatile atomic<T>* obj);
//
// template <class T>
// T
// atomic_load(const atomic<T>* obj);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_load(&t) == T(1));
volatile A vt;
std::atomic_init(&vt, T(2));
assert(std::atomic_load(&vt) == T(2));
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,71 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// T
// atomic_load_explicit(const volatile atomic<T>* obj, memory_order m);
//
// template <class T>
// T
// atomic_load_explicit(const atomic<T>* obj, memory_order m);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
assert(std::atomic_load_explicit(&t, std::memory_order_seq_cst) == T(1));
volatile A vt;
std::atomic_init(&vt, T(2));
assert(std::atomic_load_explicit(&vt, std::memory_order_seq_cst) == T(2));
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,71 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// void
// atomic_store(volatile atomic<T>* obj, T desr);
//
// template <class T>
// void
// atomic_store(atomic<T>* obj, T desr);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
typedef std::atomic<T> A;
A t;
std::atomic_store(&t, T(1));
assert(t == T(1));
volatile A vt;
std::atomic_store(&vt, T(2));
assert(vt == T(2));
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,71 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// template <class T>
// void
// atomic_store_explicit(volatile atomic<T>* obj, T desr, memory_order m);
//
// template <class T>
// void
// atomic_store_explicit(atomic<T>* obj, T desr, memory_order m);
#include <atomic>
#include <cassert>
template <class T>
void
test()
{
typedef std::atomic<T> A;
A t;
std::atomic_store_explicit(&t, T(1), std::memory_order_seq_cst);
assert(t == T(1));
volatile A vt;
std::atomic_store_explicit(&vt, T(2), std::memory_order_seq_cst);
assert(vt == T(2));
}
struct A
{
int i;
explicit A(int d = 0) : i(d) {}
A(const A& a) : i(a.i) {}
A(const volatile A& a) : i(a.i) {}
void operator=(const volatile A& a) volatile {i = a.i;}
friend bool operator==(const A& x, const A& y)
{return x.i == y.i;}
};
int main()
{
test<A>();
test<char>();
test<signed char>();
test<unsigned char>();
test<short>();
test<unsigned short>();
test<int>();
test<unsigned int>();
test<long>();
test<unsigned long>();
test<long long>();
test<unsigned long long>();
test<wchar_t>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
test<int*>();
test<const int*>();
}

View File

@@ -1,21 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <atomic>
// #define ATOMIC_VAR_INIT(value)
#include <atomic>
#include <cassert>
int main()
{
std::atomic<int> v = ATOMIC_VAR_INIT(5);
assert(v == 5);
}

View File

@@ -1,13 +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.
//
//===----------------------------------------------------------------------===//
int main()
{
}

View File

@@ -1,13 +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.
//
//===----------------------------------------------------------------------===//
int main()
{
}

View File

@@ -63,8 +63,7 @@ int main()
std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
std::map<int, double>::iterator i;
i = m.begin();
std::map<int, double>::iterator i = m.begin();
std::map<int, double>::const_iterator k = i;
assert(i == k);
for (int j = 1; j <= m.size(); ++j, ++i)
@@ -109,8 +108,7 @@ int main()
assert(std::distance(m.cbegin(), m.cend()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size());
std::map<int, double>::const_iterator i;
i = m.begin();
std::map<int, double>::const_iterator i = m.begin();
for (int j = 1; j <= m.size(); ++j, ++i)
{
assert(i->first == j);

View File

@@ -1,25 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <map>
// class map
// map();
#include <map>
struct X
{
std::multimap<int, X> m;
};
int main()
{
}

View File

@@ -63,8 +63,7 @@ int main()
std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
std::multimap<int, double>::iterator i;
i = m.begin();
std::multimap<int, double>::iterator i = m.begin();
std::multimap<int, double>::const_iterator k = i;
assert(i == k);
for (int j = 1; j <= 8; ++j)
@@ -110,8 +109,7 @@ int main()
assert(std::distance(m.cbegin(), m.cend()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size());
std::multimap<int, double>::const_iterator i;
i = m.begin();
std::multimap<int, double>::const_iterator i = m.begin();
for (int j = 1; j <= 8; ++j)
for (double d = 1; d <= 2; d += .5, ++i)
{

View File

@@ -63,8 +63,7 @@ int main()
std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
std::multiset<int>::iterator i;
i = m.begin();
std::multiset<int>::iterator i = m.begin();
std::multiset<int>::const_iterator k = i;
assert(i == k);
for (int j = 1; j <= 8; ++j)
@@ -105,8 +104,7 @@ int main()
assert(std::distance(m.cbegin(), m.cend()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size());
std::multiset<int, double>::const_iterator i;
i = m.begin();
std::multiset<int, double>::const_iterator i = m.begin();
for (int j = 1; j <= 8; ++j)
for (int k = 0; k < 3; ++k, ++i)
assert(*i == j);

View File

@@ -63,8 +63,7 @@ int main()
std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
assert(std::distance(m.begin(), m.end()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
std::set<int>::iterator i;
i = m.begin();
std::set<int>::iterator i = m.begin();
std::set<int>::const_iterator k = i;
assert(i == k);
for (int j = 1; j <= m.size(); ++j, ++i)
@@ -104,8 +103,7 @@ int main()
assert(std::distance(m.cbegin(), m.cend()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size());
std::set<int, double>::const_iterator i;
i = m.begin();
std::set<int, double>::const_iterator i = m.begin();
for (int j = 1; j <= m.size(); ++j, ++i)
assert(*i == j);
}

View File

@@ -20,8 +20,7 @@ int main()
typedef double T;
typedef std::array<T, 3> C;
C c = {1, 2, 3.5};
C::iterator i;
i = c.begin();
C::iterator i = c.begin();
assert(*i == 1);
assert(&*i == c.data());
*i = 5.5;

View File

@@ -1,32 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <deque>
// Test nested types and default template args:
// template <class T, class Allocator = allocator<T> >
// class deque;
// iterator, const_iterator
#include <deque>
#include <iterator>
#include <cassert>
int main()
{
typedef std::deque<int> C;
C c;
C::iterator i;
i = c.begin();
C::const_iterator j;
j = c.cbegin();
assert(i == j);
}

View File

@@ -67,6 +67,5 @@ int main()
typedef int T;
typedef std::forward_list<T> C;
C::iterator i;
C::const_iterator j;
}
}

View File

@@ -1,72 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <list>
// iterator begin();
// iterator end();
// const_iterator begin() const;
// const_iterator end() const;
// const_iterator cbegin() const;
// const_iterator cend() const;
#include <list>
#include <cassert>
#include <iterator>
int main()
{
{
typedef int T;
typedef std::list<T> C;
C c;
C::iterator i = c.begin();
C::iterator j = c.end();
assert(std::distance(i, j) == 0);
assert(i == j);
}
{
typedef int T;
typedef std::list<T> C;
const C c;
C::const_iterator i = c.begin();
C::const_iterator j = c.end();
assert(std::distance(i, j) == 0);
assert(i == j);
}
{
typedef int T;
typedef std::list<T> C;
C c;
C::const_iterator i = c.cbegin();
C::const_iterator j = c.cend();
assert(std::distance(i, j) == 0);
assert(i == j);
assert(i == c.end());
}
{
typedef int T;
typedef std::list<T> C;
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(std::begin(t), std::end(t));
C::iterator i = c.begin();
assert(*i == 0);
++i;
assert(*i == 1);
*i = 10;
assert(*i == 10);
assert(std::distance(c.begin(), c.end()) == 10);
}
{
typedef int T;
typedef std::list<T> C;
C::iterator i;
C::const_iterator j;
}
}

View File

@@ -1,59 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <vector>
// iterator begin();
// iterator end();
// const_iterator begin() const;
// const_iterator end() const;
// const_iterator cbegin() const;
// const_iterator cend() const;
#include <vector>
#include <cassert>
#include <iterator>
int main()
{
{
typedef bool T;
typedef std::vector<T> C;
C c;
C::iterator i = c.begin();
C::iterator j = c.end();
assert(std::distance(i, j) == 0);
assert(i == j);
}
{
typedef bool T;
typedef std::vector<T> C;
const C c;
C::const_iterator i = c.begin();
C::const_iterator j = c.end();
assert(std::distance(i, j) == 0);
assert(i == j);
}
{
typedef bool T;
typedef std::vector<T> C;
C c;
C::const_iterator i = c.cbegin();
C::const_iterator j = c.cend();
assert(std::distance(i, j) == 0);
assert(i == j);
assert(i == c.end());
}
{
typedef bool T;
typedef std::vector<T> C;
C::iterator i;
C::const_iterator j;
}
}

View File

@@ -1,72 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <vector>
// iterator begin();
// iterator end();
// const_iterator begin() const;
// const_iterator end() const;
// const_iterator cbegin() const;
// const_iterator cend() const;
#include <vector>
#include <cassert>
#include <iterator>
int main()
{
{
typedef int T;
typedef std::vector<T> C;
C c;
C::iterator i = c.begin();
C::iterator j = c.end();
assert(std::distance(i, j) == 0);
assert(i == j);
}
{
typedef int T;
typedef std::vector<T> C;
const C c;
C::const_iterator i = c.begin();
C::const_iterator j = c.end();
assert(std::distance(i, j) == 0);
assert(i == j);
}
{
typedef int T;
typedef std::vector<T> C;
C c;
C::const_iterator i = c.cbegin();
C::const_iterator j = c.cend();
assert(std::distance(i, j) == 0);
assert(i == j);
assert(i == c.end());
}
{
typedef int T;
typedef std::vector<T> C;
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(std::begin(t), std::end(t));
C::iterator i = c.begin();
assert(*i == 0);
++i;
assert(*i == 1);
*i = 10;
assert(*i == 10);
assert(std::distance(c.begin(), c.end()) == 10);
}
{
typedef int T;
typedef std::vector<T> C;
C::iterator i;
C::const_iterator j;
}
}

View File

@@ -43,7 +43,6 @@ int main()
assert(c.size() == 4);
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::iterator i;
}
{
typedef std::unordered_map<int, std::string> C;
@@ -62,6 +61,5 @@ int main()
assert(c.size() == 4);
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
}

View File

@@ -43,8 +43,7 @@ int main()
assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::iterator i;
i = c.begin();
C::iterator i = c.begin();
i->second = "ONE";
assert(i->second == "ONE");
}
@@ -65,6 +64,5 @@ int main()
assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
}

View File

@@ -42,7 +42,6 @@ int main()
assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::iterator i;
}
{
typedef std::unordered_multiset<int> C;
@@ -61,6 +60,5 @@ int main()
assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
}

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