Compare commits

..

1 Commits

Author SHA1 Message Date
Howard Hinnant
0e1f6f5856 Tagging 25
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/tags/libcpp-25@135270 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 13:52:54 +00:00
301 changed files with 1919 additions and 5738 deletions

View File

@@ -20,15 +20,3 @@ D: Minor patches and bug fixes.
N: Bjorn Reese
E: breese@users.sourceforge.net
D: Initial regex prototype
N: David Chisnall
E: theraven at theravensnest dot org
D: FreeBSD port and libcxxrt support.
N: Ruben Van Boxem
E: vanboxem dot ruben at gmail dot com
D: Initial Windows patches.
N: Arvid Picciani
E: aep at exys dot org
D: Minor patches and musl port.

View File

@@ -29,34 +29,13 @@ clean::
installhdrs::
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/include
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext/*
install:: installhdrs $(DESTDIR)

View File

@@ -687,12 +687,12 @@ move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst>
// swap_ranges
template <class __C1, class __C2>
__bit_iterator<__C2, false>
__swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
__bit_iterator<__C2, false> __result)
template <class _C1, class _C2>
__bit_iterator<_C2, false>
__swap_ranges_aligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
__bit_iterator<_C2, false> __result)
{
typedef __bit_iterator<__C1, false> _I1;
typedef __bit_iterator<_C1, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
@@ -737,12 +737,12 @@ __swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1,
return __result;
}
template <class __C1, class __C2>
__bit_iterator<__C2, false>
__swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
__bit_iterator<__C2, false> __result)
template <class _C1, class _C2>
__bit_iterator<_C2, false>
__swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
__bit_iterator<_C2, false> __result)
{
typedef __bit_iterator<__C1, false> _I1;
typedef __bit_iterator<_C1, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
@@ -837,11 +837,11 @@ __swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1
return __result;
}
template <class __C1, class __C2>
template <class _C1, class _C2>
inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<__C2, false>
swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1,
__bit_iterator<__C2, false> __first2)
__bit_iterator<_C2, false>
swap_ranges(__bit_iterator<_C1, false> __first1, __bit_iterator<_C1, false> __last1,
__bit_iterator<_C2, false> __first2)
{
if (__first1.__ctz_ == __first2.__ctz_)
return __swap_ranges_aligned(__first1, __last1, __first2);
@@ -1213,15 +1213,15 @@ private:
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first,
__bit_iterator<_D, _IC> __last,
__bit_iterator<_D, false> __result);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_aligned(__bit_iterator<_C1, false>,
__bit_iterator<_C1, false>,
__bit_iterator<_C2, false>);
template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_unaligned(__bit_iterator<_C1, false>,
__bit_iterator<_C1, false>,
__bit_iterator<_C2, false>);
template <class _C1, class _C2>friend __bit_iterator<_C2, false> swap_ranges(__bit_iterator<_C1, false>,
__bit_iterator<_C1, false>,
__bit_iterator<_C2, false>);
template <class _D> friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>,
__bit_iterator<_D, false>,
__bit_iterator<_D, false>);

View File

@@ -13,7 +13,7 @@
#pragma GCC system_header
#define _LIBCPP_VERSION 1001
#define _LIBCPP_VERSION 1000
#define _LIBCPP_ABI_VERSION 1
@@ -50,10 +50,6 @@
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
// Compiler intrinsics (GCC or MSVC)
# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
# define _LIBCP_HAS_IS_BASE_OF
# endif
#endif // _WIN32
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
@@ -150,9 +146,6 @@ typedef __char32_t char32_t;
#if !(__has_feature(cxx_auto_type))
#define _LIBCPP_HAS_NO_AUTO_TYPE
#endif
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
@@ -164,14 +157,6 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#endif
#if !(__has_feature(cxx_generalized_initializers))
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif
#if __has_feature(is_base_of)
# define _LIBCP_HAS_IS_BASE_OF
#endif
// Objective-C++ features (opt-in)
#if __has_feature(objc_arc)
#define _LIBCPP_HAS_OBJC_ARC
@@ -203,10 +188,6 @@ namespace std {
# define _NOEXCEPT_(x)
#endif
#if __has_feature(underlying_type)
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
#endif
// end defined(__clang__)
#elif defined(__GNUC__)
@@ -256,7 +237,6 @@ namespace std {
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
@@ -305,32 +285,12 @@ template <unsigned> struct __static_assert_check {};
#define __has_feature(__x) 0
#endif
#if __APPLE__ || __FreeBSD__ || _WIN32
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#ifdef __APPLE__
#define _LIBCPP_STABLE_APPLE_ABI
#endif
#if __APPLE__ || __FreeBSD__
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif
#if __APPLE__ || __FreeBSD__
#ifdef __APPLE__
#define _LIBCPP_WCTYPE_IS_MASK
#endif
#ifdef _LIBCPP_DEBUG2
# if _LIBCPP_DEBUG2 == 0
# define _LIBCPP_DEBUG_LEVEL 1
# elif _LIBCPP_DEBUG2 == 1
# define _LIBCPP_DEBUG_LEVEL 2
# else
# error Supported values for _LIBCPP_DEBUG2 are 0 and 1
# endif
#endif
#ifdef _LIBCPP_DEBUG2
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
#endif // _LIBCPP_CONFIG

View File

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

View File

@@ -432,10 +432,9 @@ public:
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_node_destructor(allocator_type& __na,
bool __constructed = false) _NOEXCEPT
explicit __hash_node_destructor(allocator_type& __na) _NOEXCEPT
: __na_(__na),
__value_constructed(__constructed)
__value_constructed(false)
{}
_LIBCPP_INLINE_VISIBILITY
@@ -1754,7 +1753,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
__pn->__next_ = __cn->__next_;
__cn->__next_ = nullptr;
--size();
return __node_holder(__cn, _D(__node_alloc(), true));
return __node_holder(__cn, _D(__node_alloc()));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>

View File

@@ -19,11 +19,7 @@
#include <cstdint>
#include <cctype>
#include <locale.h>
#if _WIN32
# include <support/win32/locale_win32.h>
#elif (__GLIBC__ || __APPLE__ || __FreeBSD__)
# include <xlocale.h>
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
#include <xlocale.h>
#pragma GCC system_header
@@ -231,18 +227,18 @@ collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
template <class _CharT>
long
collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
{
size_t __h = 0;
const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t __mask = size_t(0xF) << (__sr + 4);
for(const char_type* __p = __lo; __p != __hi; ++__p)
size_t h = 0;
const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t mask = size_t(0xF) << (sr + 4);
for(const char_type* p = lo; p != hi; ++p)
{
__h = (__h << 4) + *__p;
size_t __g = __h & __mask;
__h ^= __g | (__g >> __sr);
h = (h << 4) + *p;
size_t g = h & mask;
h ^= g | (g >> sr);
}
return static_cast<long>(__h);
return static_cast<long>(h);
}
extern template class _LIBCPP_VISIBLE collate<char>;
@@ -306,36 +302,13 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
class _LIBCPP_VISIBLE ctype_base
{
public:
#if __GLIBC__
#ifdef __GLIBC__
typedef unsigned short mask;
static const mask space = _ISspace;
static const mask print = _ISprint;
static const mask cntrl = _IScntrl;
static const mask upper = _ISupper;
static const mask lower = _ISlower;
static const mask alpha = _ISalpha;
static const mask digit = _ISdigit;
static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit;
static const mask blank = _ISblank;
#elif _WIN32
typedef unsigned short mask;
static const mask space = _SPACE;
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
static const mask cntrl = _CONTROL;
static const mask upper = _UPPER;
static const mask lower = _LOWER;
static const mask alpha = _ALPHA;
static const mask digit = _DIGIT;
static const mask punct = _PUNCT;
static const mask xdigit = _HEX;
static const mask blank = _BLANK;
#elif (__APPLE__ || __FreeBSD__)
#if __APPLE__
#else
typedef __uint32_t mask;
#elif __FreeBSD__
typedef unsigned long mask;
#endif
#if __APPLE__
static const mask space = _CTYPE_S;
static const mask print = _CTYPE_R;
static const mask cntrl = _CTYPE_C;
@@ -346,19 +319,18 @@ public:
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B;
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
typedef unsigned long mask;
static const mask space = 1<<0;
static const mask print = 1<<1;
static const mask cntrl = 1<<2;
static const mask upper = 1<<3;
static const mask lower = 1<<4;
static const mask alpha = 1<<5;
static const mask digit = 1<<6;
static const mask punct = 1<<7;
static const mask xdigit = 1<<8;
static const mask blank = 1<<9;
#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
#else // __APPLE__
static const mask space = _ISspace;
static const mask print = _ISprint;
static const mask cntrl = _IScntrl;
static const mask upper = _ISupper;
static const mask lower = _ISlower;
static const mask alpha = _ISalpha;
static const mask digit = _ISdigit;
static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit;
static const mask blank = _ISblank;
#endif // __APPLE__
static const mask alnum = alpha | digit;
static const mask graph = alnum | punct;
@@ -569,7 +541,7 @@ public:
#endif
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
static const mask* classic_table() _NOEXCEPT;
#if defined(__GLIBC__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT;
#endif

View File

@@ -141,14 +141,14 @@ public:
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer& __c, true_type)
void __move_assign_alloc(const __split_buffer& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer& __c, false_type) _NOEXCEPT
void __move_assign_alloc(const __split_buffer& __c, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
@@ -208,7 +208,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
__alloc_rr& __a = this->__alloc();
do
{
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), value_type());
++this->__end_;
--__n;
} while (__n > 0);

View File

@@ -593,6 +593,9 @@ template <class BidirectionalIterator, class Compare>
#include <utility>
#include <memory>
#include <iterator>
#ifdef _LIBCPP_DEBUG
#include <cassert>
#endif
#include <cstdlib>
#pragma GCC system_header
@@ -673,7 +676,7 @@ public:
bool operator()(const _T1& __x, const _T2& __y) {return !__p_(__x, __y);}
};
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
template <class _Compare>
struct __debug_less
@@ -685,12 +688,12 @@ struct __debug_less
{
bool __r = __comp_(__x, __y);
if (__r)
_LIBCPP_ASSERT(!__comp_(__y, __x), "Comparator does not induce a strict weak ordering");
assert(!__comp_(__y, __x));
return __r;
}
};
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
// Precondition: __x != 0
inline _LIBCPP_INLINE_VISIBILITY unsigned __ctz(unsigned __x) {return __builtin_ctz (__x);}
@@ -2230,8 +2233,6 @@ min(const _Tp& __a, const _Tp& __b)
return _VSTD::min(__a, __b, __less<_Tp>());
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
_Tp
@@ -2248,8 +2249,6 @@ min(initializer_list<_Tp> __t)
return *_VSTD::min_element(__t.begin(), __t.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// max_element
template <class _ForwardIterator, class _Compare>
@@ -2294,8 +2293,6 @@ max(const _Tp& __a, const _Tp& __b)
return _VSTD::max(__a, __b, __less<_Tp>());
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
_Tp
@@ -2312,8 +2309,6 @@ max(initializer_list<_Tp> __t)
return *_VSTD::max_element(__t.begin(), __t.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// minmax_element
template <class _ForwardIterator, class _Compare>
@@ -2393,8 +2388,6 @@ minmax(const _Tp& __a, const _Tp& __b)
return _VSTD::minmax(__a, __b, __less<_Tp>());
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
pair<_Tp, _Tp>
@@ -2415,8 +2408,6 @@ minmax(initializer_list<_Tp> __t, _Compare __comp)
return pair<_Tp, _Tp>(*__p.first, *__p.second);
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// random_shuffle
// __independent_bits_engine
@@ -3638,14 +3629,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__sort<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__sort<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _RandomAccessIterator>
@@ -3672,15 +3663,6 @@ sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last)
_VSTD::sort(__first.base(), __last.base());
}
template <class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
void
sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp)
{
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
}
extern template void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
extern template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
extern template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
@@ -3744,14 +3726,14 @@ inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __lower_bound<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __lower_bound<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _ForwardIterator, class _Tp>
@@ -3792,14 +3774,14 @@ inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __upper_bound<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __upper_bound<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _ForwardIterator, class _Tp>
@@ -3852,14 +3834,14 @@ inline _LIBCPP_INLINE_VISIBILITY
pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __equal_range<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __equal_range<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _ForwardIterator, class _Tp>
@@ -3887,14 +3869,14 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __binary_search<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __binary_search<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _ForwardIterator, class _Tp>
@@ -3937,14 +3919,14 @@ _OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -4111,16 +4093,16 @@ inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _
__buf = _VSTD::get_temporary_buffer<value_type>(__buf_size);
__h.reset(__buf.first);
}
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __c, __len1, __len2,
__buf.first, __buf.second);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,
__buf.first, __buf.second);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _BidirectionalIterator>
@@ -4322,14 +4304,14 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar
__buf = _VSTD::get_temporary_buffer<value_type>(__len);
__h.reset(__buf.first);
}
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__stable_sort<_Comp_ref>(__first, __last, __c, __len, __buf.first, __buf.second);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _RandomAccessIterator>
@@ -4471,14 +4453,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__push_heap_back<_Comp_ref>(__first, __last, __c, __last - __first);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__push_heap_back<_Comp_ref>(__first, __last, __comp, __last - __first);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _RandomAccessIterator>
@@ -4509,14 +4491,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__pop_heap<_Comp_ref>(__first, __last, __c, __last - __first);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _RandomAccessIterator>
@@ -4549,14 +4531,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__make_heap<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__make_heap<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _RandomAccessIterator>
@@ -4583,14 +4565,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__sort_heap<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__sort_heap<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _RandomAccessIterator>
@@ -4627,14 +4609,14 @@ void
partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
_Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__partial_sort<_Comp_ref>(__first, __middle, __last, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _RandomAccessIterator>
@@ -4677,14 +4659,14 @@ _RandomAccessIterator
partial_sort_copy(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _InputIterator, class _RandomAccessIterator>
@@ -4889,14 +4871,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__nth_element<_Comp_ref>(__first, __nth, __last, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__nth_element<_Comp_ref>(__first, __nth, __last, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _RandomAccessIterator>
@@ -4930,14 +4912,14 @@ bool
includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
_Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _InputIterator1, class _InputIterator2>
@@ -4983,14 +4965,14 @@ _OutputIterator
set_union(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5035,14 +5017,14 @@ _OutputIterator
set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5089,14 +5071,14 @@ _OutputIterator
set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5148,14 +5130,14 @@ _OutputIterator
set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5192,14 +5174,14 @@ bool
lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _InputIterator1, class _InputIterator2>
@@ -5247,14 +5229,14 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __next_permutation<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __next_permutation<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _BidirectionalIterator>
@@ -5300,14 +5282,14 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG2
#ifdef _LIBCPP_DEBUG
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __prev_permutation<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG2
#else // _LIBCPP_DEBUG
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __prev_permutation<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG2
#endif // _LIBCPP_DEBUG
}
template <class _BidirectionalIterator>

View File

@@ -1033,14 +1033,6 @@ struct _LIBCPP_VISIBLE hash<bitset<_Size> >
{return __bs.__hash_code();}
};
template <class _CharT, class _Traits, size_t _Size>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
template <class _CharT, class _Traits, size_t _Size>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_BITSET

View File

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

View File

@@ -106,9 +106,6 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config>
#include <cwctype>
#include <wchar.h>
#if _WIN32
#include <support/win32/support.h> // pull in *swprintf defines
#endif // _WIN32
#pragma GCC system_header

View File

@@ -977,14 +977,14 @@ protected:
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__deque_base& __c, true_type)
void __move_assign_alloc(const __deque_base& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__deque_base& __c, false_type) _NOEXCEPT
void __move_assign_alloc(const __deque_base& __c, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
@@ -1204,16 +1204,12 @@ public:
typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
deque(const deque& __c);
deque(const deque& __c, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
deque(initializer_list<value_type> __il);
deque(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
deque& operator=(const deque& __c);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
@@ -1231,10 +1227,8 @@ public:
void assign(_RAIter __f, _RAIter __l,
typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
void assign(size_type __n, const value_type& __v);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
allocator_type get_allocator() const _NOEXCEPT;
@@ -1319,11 +1313,9 @@ public:
template <class _BiIter>
iterator insert (const_iterator __p, _BiIter __f, _BiIter __l,
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, initializer_list<value_type> __il)
{return insert(__p, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void pop_front();
void pop_back();
iterator erase(const_iterator __p);
@@ -1460,8 +1452,6 @@ deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a)
__append(__c.begin(), __c.end());
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
{
@@ -1475,8 +1465,6 @@ deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator
__append(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>&
deque<_Tp, _Allocator>::operator=(const deque& __c)

View File

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

View File

@@ -203,11 +203,8 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <__hash_table>
#include <functional>
#include <stdexcept>
#include <ext/__hash>
#if __DEPRECATED
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
#endif
#pragma GCC system_header
@@ -469,7 +466,6 @@ public:
// types
typedef _Key key_type;
typedef _Tp mapped_type;
typedef _Tp data_type;
typedef _Hash hasher;
typedef _Pred key_equal;
typedef _Alloc allocator_type;
@@ -553,8 +549,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
@@ -748,7 +742,6 @@ public:
// types
typedef _Key key_type;
typedef _Tp mapped_type;
typedef _Tp data_type;
typedef _Hash hasher;
typedef _Pred key_equal;
typedef _Alloc allocator_type;
@@ -830,8 +823,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);

View File

@@ -196,17 +196,14 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__config>
#include <__hash_table>
#include <functional>
#include <ext/__hash>
#if __DEPRECATED
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
#endif
namespace __gnu_cxx {
using namespace std;
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
template <class _Value, class _Hash = std::hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_VISIBLE hash_set
{
@@ -275,8 +272,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
@@ -495,8 +490,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);

View File

@@ -580,10 +580,8 @@ public:
: base(_VSTD::move(__x)) {}
forward_list(forward_list&& __x, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
forward_list(initializer_list<value_type> __il);
forward_list(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~forward_list() = default;
@@ -594,9 +592,7 @@ public:
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
forward_list& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _InputIterator>
typename enable_if
@@ -606,9 +602,7 @@ public:
>::type
assign(_InputIterator __f, _InputIterator __l);
void assign(size_type __n, const value_type& __v);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void assign(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -683,10 +677,8 @@ public:
iterator
>::type
insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
{return insert_after(__p, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator erase_after(const_iterator __p);
iterator erase_after(const_iterator __f, const_iterator __l);
@@ -851,8 +843,6 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
{
@@ -867,8 +857,6 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
insert_after(cbefore_begin(), __il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
@@ -922,8 +910,6 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
forward_list<_Tp, _Alloc>&
@@ -933,8 +919,6 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
template <class _InputIterator>
typename enable_if
@@ -970,8 +954,6 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
erase_after(__i, __e);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
@@ -980,8 +962,6 @@ forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
assign(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS

View File

@@ -51,8 +51,6 @@ template<class E> const E* end(initializer_list<E> il) noexcept;
namespace std // purposefully not versioned
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _E>
class _LIBCPP_VISIBLE initializer_list
{
@@ -96,8 +94,6 @@ end(initializer_list<_E> __il) _NOEXCEPT
return __il.end();
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
} // std
#endif // _LIBCPP_INITIALIZER_LIST

View File

@@ -742,29 +742,26 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen)
{
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __n = __is.width();
if (__n <= 0)
if (__n == 0)
__n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
streamsize __c = 0;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
ios_base::iostate __err = ios_base::goodbit;
while (__c < __n-1)
_I __i(__is);
_I __eof;
for (; __i != __eof && __c < __n-1; ++__i, ++__s, ++__c)
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
_CharT __ch = *__i;
if (__ct.is(__ct.space, __ch))
break;
*__s++ = __ch;
++__c;
__is.rdbuf()->sbumpc();
*__s = __ch;
}
*__s = _CharT();
__is.width(0);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
__is.setstate(__err);
@@ -806,11 +803,25 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen)
{
#if 1
typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
__is.setstate(ios_base::eofbit | ios_base::failbit);
else
__c = _Traits::to_char_type(__i);
#else
typedef istreambuf_iterator<_CharT, _Traits> _I;
_I __i(__is);
_I __eof;
if (__i != __eof)
{
__c = *__i;
if (++__i == __eof)
__is.setstate(ios_base::eofbit);
}
else
__is.setstate(ios_base::eofbit | ios_base::failbit);
#endif
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -850,42 +861,42 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
sentry __s(*this, true);
if (__s)
{
streamsize __c = 0;
if (__sb)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
ios_base::iostate __err = ios_base::goodbit;
while (true)
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef ostreambuf_iterator<char_type, traits_type> _O;
_I __i(*this);
_I __eof;
_O __o(__sb);
for (; __i != __eof; ++__i, ++__o, ++__c)
{
typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
if (traits_type::eq_int_type(
__sb->sputc(traits_type::to_char_type(__i)),
traits_type::eof()))
*__o = *__i;
if (__o.failed())
break;
++__gc_;
this->rdbuf()->sbumpc();
}
if (__gc_ == 0)
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
this->setstate(__err);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
if (__gc_ == 0)
if (__c == 0)
this->__set_failbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
else
this->setstate(ios_base::failbit);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -910,11 +921,22 @@ basic_istream<_CharT, _Traits>::get()
sentry __s(*this, true);
if (__s)
{
__r = this->rdbuf()->sbumpc();
if (traits_type::eq_int_type(__r, traits_type::eof()))
this->setstate(ios_base::failbit | ios_base::eofbit);
streamsize __c = 0;
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
ios_base::iostate __err = ios_base::goodbit;
if (__i != __eof)
{
__r = traits_type::to_int_type(*__i);
++__c;
if (++__i == __eof)
__err |= ios_base::eofbit;
}
else
__gc_ = 1;
__err |= ios_base::failbit | ios_base::eofbit;
this->setstate(__err);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -949,31 +971,30 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
sentry __sen(*this, true);
if (__sen)
{
streamsize __c = 0;
if (__n > 0)
{
ios_base::iostate __err = ios_base::goodbit;
while (__gc_ < __n-1)
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
for (; __i != __eof && __n > 1; ++__i, ++__s, ++__c)
{
int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
char_type __ch = *__i;
if (traits_type::eq(__ch, __dlm))
break;
*__s++ = __ch;
++__gc_;
this->rdbuf()->sbumpc();
*__s = __ch;
}
*__s = char_type();
if (__gc_ == 0)
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
this->setstate(__err);
}
else
this->setstate(ios_base::failbit);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1006,36 +1027,38 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
sentry __sen(*this, true);
if (__sen)
{
streamsize __c = 0;
ios_base::iostate __err = ios_base::goodbit;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
while (true)
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef ostreambuf_iterator<char_type, traits_type> _O;
_I __i(*this);
_I __eof;
_O __o(&__sb);
for (; __i != __eof; ++__i, ++__o, ++__c)
{
typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
char_type __ch = *__i;
if (traits_type::eq(__ch, __dlm))
break;
if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
*__o = __ch;
if (__o.failed())
break;
++__gc_;
this->rdbuf()->sbumpc();
}
if (__i == __eof)
__err |= ios_base::eofbit;
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
if (__gc_ == 0)
if (__c == 0)
__err |= ios_base::failbit;
this->setstate(__err);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1067,36 +1090,33 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
sentry __sen(*this, true);
if (__sen)
{
ios_base::iostate __err = ios_base::goodbit;
while (true)
streamsize __c = 0;
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
for (; __i != __eof; ++__s, --__n)
{
typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
char_type __ch = *__i;
++__i;
++__c;
if (traits_type::eq(__ch, __dlm))
break;
if (__n < 2)
{
this->rdbuf()->sbumpc();
++__gc_;
this->setstate(ios_base::failbit);
break;
}
if (__gc_ >= __n-1)
{
__err |= ios_base::failbit;
break;
}
*__s++ = __ch;
this->rdbuf()->sbumpc();
++__gc_;
*__s = __ch;
}
if (__n > 0)
if (__n)
*__s = char_type();
if (__gc_ == 0)
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
this->setstate(__err);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1128,40 +1148,35 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
sentry __sen(*this, true);
if (__sen)
{
ios_base::iostate __err = ios_base::goodbit;
if (__n == numeric_limits<streamsize>::max())
streamsize __c = 0;
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
if (__n != numeric_limits<streamsize>::max())
{
while (true)
for (; __n > 0 && __i != __eof; --__n)
{
typename traits_type::int_type __i = this->rdbuf()->sbumpc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
++__gc_;
char_type __ch = traits_type::to_char_type(__i);
char_type __ch = *__i;
++__i;
++__c;
if (traits_type::eq(__ch, __dlm))
break;
}
}
else
{
while (__gc_ < __n)
while (__i != __eof)
{
typename traits_type::int_type __i = this->rdbuf()->sbumpc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
++__gc_;
char_type __ch = traits_type::to_char_type(__i);
char_type __ch = *__i;
++__i;
++__c;
if (traits_type::eq(__ch, __dlm))
break;
}
}
this->setstate(__err);
if (__i == __eof)
this->setstate(ios_base::eofbit);
__gc_ = __c;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1208,17 +1223,20 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
sentry __sen(*this, true);
if (__sen)
{
ios_base::iostate __err = ios_base::goodbit;
for (; __gc_ < __n; ++__gc_)
streamsize __c = 0;
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
for (; __i != __eof && __n > 0; ++__i, ++__s, ++__c, --__n)
*__s = *__i;
if (__i == __eof)
{
typename traits_type::int_type __i = this->rdbuf()->sbumpc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
this->setstate(ios_base::failbit | ios_base::eofbit);
break;
}
*__s++ = traits_type::to_char_type(__i);
ios_base::iostate __err = ios_base::eofbit;
if (__n > 0)
__err |= ios_base::failbit;
this->setstate(__err);
}
__gc_ = __c;
}
else
this->setstate(ios_base::failbit);
@@ -1236,19 +1254,45 @@ template<class _CharT, class _Traits>
streamsize
basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
{
streamsize __c = this->rdbuf()->in_avail();
switch (__c)
__gc_ = 0;
streamsize __c = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
case -1:
this->setstate(ios_base::eofbit);
break;
case 0:
break;
default:
read(__s, _VSTD::min(__c, __n));
break;
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this, true);
if (__sen)
{
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
__c = this->rdbuf()->in_avail();
switch (__c)
{
case -1:
__i = __eof;
break;
case 0:
break;
default:
__c = _VSTD::min(__c, __n);
for (streamsize __k = 0; __k < __c; ++__k, ++__s, ++__i)
*__s = *__i;
}
if (__i == __eof)
this->setstate(ios_base::eofbit);
__gc_ = __c;
}
else
this->setstate(ios_base::failbit);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
return __gc_;
catch (...)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
return __c;
}
template<class _CharT, class _Traits>
@@ -1411,19 +1455,15 @@ ws(basic_istream<_CharT, _Traits>& __is)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
if (__sen)
{
typedef istreambuf_iterator<_CharT, _Traits> _I;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
while (true)
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__is.setstate(ios_base::eofbit);
break;
}
if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
_I __i(__is);
_I __eof;
for (; __i != __eof; ++__i)
if (!__ct.is(__ct.space, *__i))
break;
__is.rdbuf()->sbumpc();
}
if (__i == __eof)
__is.setstate(ios_base::failbit | ios_base::eofbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1532,30 +1572,27 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
if (__sen)
{
__str.clear();
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __n = __is.width();
if (__n <= 0)
if (__n == 0)
__n = __str.max_size();
if (__n <= 0)
if (__n < 0)
__n = numeric_limits<streamsize>::max();
streamsize __c = 0;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
ios_base::iostate __err = ios_base::goodbit;
while (__c < __n)
_I __i(__is);
_I __eof;
for (; __i != __eof && __c < __n; ++__i, ++__c)
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
_CharT __ch = *__i;
if (__ct.is(__ct.space, __ch))
break;
__str.push_back(__ch);
++__c;
__is.rdbuf()->sbumpc();
}
__is.width(0);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
__is.setstate(__err);
@@ -1585,28 +1622,31 @@ getline(basic_istream<_CharT, _Traits>& __is,
if (__sen)
{
__str.clear();
ios_base::iostate __err = ios_base::goodbit;
streamsize __extr = 0;
while (true)
streamsize __c = 0;
typedef istreambuf_iterator<_CharT, _Traits> _I;
_I __i(__is);
_I __eof;
streamsize __n = __str.max_size();
if (__n < 0)
__n = numeric_limits<streamsize>::max();
for (; __i != __eof;)
{
typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
++__extr;
_CharT __ch = _Traits::to_char_type(__i);
_CharT __ch = *__i;
++__i;
++__c;
if (_Traits::eq(__ch, __dlm))
break;
__str.push_back(__ch);
if (__str.size() == __str.max_size())
if (__c == __n)
{
__err |= ios_base::failbit;
__is.setstate(ios_base::failbit);
break;
}
__str.push_back(__ch);
}
if (__extr == 0)
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
__is.setstate(__err);
}
@@ -1664,26 +1704,24 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
{
basic_string<_CharT, _Traits> __str;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __c = 0;
ios_base::iostate __err = ios_base::goodbit;
_CharT __zero = __ct.widen('0');
_CharT __one = __ct.widen('1');
while (__c < _Size)
_I __i(__is);
_I __eof;
for (; __i != __eof && __c < _Size; ++__i, ++__c)
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
_CharT __ch = *__i;
if (__ch != __zero && __ch != __one)
break;
__str.push_back(__ch);
++__c;
__is.rdbuf()->sbumpc();
}
__is.width(0);
__x = bitset<_Size>(__str);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit;
__is.setstate(__err);

View File

@@ -1035,7 +1035,7 @@ operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter>
__wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
operator+(typename __wrap_iter<_Iter>::difference_type, const __wrap_iter<_Iter>&) _NOEXCEPT;
template <class _I, class _O> _O copy(_I, _I, _O);
template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2);
@@ -1063,108 +1063,33 @@ public:
private:
iterator_type __i;
public:
_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_i(this);
#endif
}
_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT {}
template <class _Up> _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u,
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT
: __i(__u.base())
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__iterator_copy(this, &__u);
#endif
}
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
__wrap_iter(const __wrap_iter& __x)
: __i(__x.base())
{
__get_db()->__iterator_copy(this, &__x);
}
_LIBCPP_INLINE_VISIBILITY
__wrap_iter& operator=(const __wrap_iter& __x)
{
if (this != &__x)
{
__get_db()->__iterator_copy(this, &__x);
__i = __x.__i;
}
return *this;
}
_LIBCPP_INLINE_VISIBILITY
~__wrap_iter()
{
__get_db()->__erase_i(this);
}
#endif
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to dereference a non-dereferenceable iterator");
#endif
return *__i;
}
: __i(__u.base()) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT {return *__i;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to increment non-incrementable iterator");
#endif
++__i;
return *this;
}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT {++__i; return *this;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int) _NOEXCEPT
{__wrap_iter __tmp(*this); ++(*this); return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
"Attempted to decrement non-decrementable iterator");
#endif
--__i;
return *this;
}
{__wrap_iter __tmp(*this); ++__i; return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT {--__i; return *this;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _NOEXCEPT
{__wrap_iter __tmp(*this); --(*this); return __tmp;}
{__wrap_iter __tmp(*this); --__i; return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT
{__wrap_iter __w(*this); __w += __n; return __w;}
{return __wrap_iter(__i + __n);}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
"Attempted to add/subtract iterator outside of valid range");
#endif
__i += __n;
return *this;
}
{__i += __n; return *this;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _NOEXCEPT
{return *this + (-__n);}
{return __wrap_iter(__i - __n);}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
{*this += -__n; return *this;}
{__i -= __n; return *this;}
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
"Attempted to subscript iterator outside of valid range");
#endif
return __i[__n];
}
{return __i[__n];}
_LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;}
private:
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
{
__get_db()->__insert_ic(this, __p);
}
#endif
template <class _Up> friend class __wrap_iter;
template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
@@ -1208,7 +1133,7 @@ private:
template <class _Iter1>
friend
__wrap_iter<_Iter1>
operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
operator+(typename __wrap_iter<_Iter1>::difference_type, const __wrap_iter<_Iter1>&) _NOEXCEPT;
template <class _I, class _O> friend _O copy(_I, _I, _O);
template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
@@ -1230,10 +1155,6 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare incomparable iterators");
#endif
return __x.base() == __y.base();
}
@@ -1242,10 +1163,6 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare incomparable iterators");
#endif
return __x.base() < __y.base();
}
@@ -1254,7 +1171,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
return !(__x == __y);
return __x.base() != __y.base();
}
template <class _Iter1, class _Iter2>
@@ -1262,7 +1179,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
return __y < __x;
return __x.base() > __y.base();
}
template <class _Iter1, class _Iter2>
@@ -1270,7 +1187,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
return !(__x < __y);
return __x.base() >= __y.base();
}
template <class _Iter1, class _Iter2>
@@ -1278,7 +1195,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
return !(__y < __x);
return __x.base() <= __y.base();
}
template <class _Iter1, class _Iter2>
@@ -1286,10 +1203,6 @@ inline _LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to subtract incompatible iterators");
#endif
return __x.base() - __y.base();
}
@@ -1297,10 +1210,9 @@ template <class _Iter>
inline _LIBCPP_INLINE_VISIBILITY
__wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type __n,
__wrap_iter<_Iter> __x) _NOEXCEPT
const __wrap_iter<_Iter>& __x) _NOEXCEPT
{
__x += __n;
return __x;
return __wrap_iter<_Iter>(__x.base() + __n);
}
#ifdef _LIBCPP_DEBUG

File diff suppressed because it is too large Load Diff

View File

@@ -186,221 +186,160 @@ template <class charT> class messages_byname;
#endif
#include <cstdlib>
#include <ctime>
#if _WIN32
#include <support/win32/locale_win32.h>
#else // _WIN32
#include <nl_types.h>
#endif // !_WIN32
#pragma GCC system_header
_LIBCPP_BEGIN_NAMESPACE_STD
#if __APPLE__ || __FreeBSD__
# define _LIBCPP_GET_C_LOCALE 0
#else
# define _LIBCPP_GET_C_LOCALE __cloc()
// Get the C locale object
locale_t __cloc();
#define __cloc_defined
#ifndef _LIBCPP_STABLE_APPLE_ABI
// Get the C locale object
locale_t __cloc();
#endif
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr;
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
// OSX has nice foo_l() functions that let you turn off use of the global
// locale. Linux, not so much. The following functions avoid the locale when
// that's possible and otherwise do the wrong thing. FIXME.
#ifdef __linux__
#if __APPLE__
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mb_cur_max_l(locale_t __l)
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, _Tp __v)
{
return MB_CUR_MAX_L(__l);
return sprintf_l(__str, 0, __format, __v);
}
#else // _LIBCPP_LOCALE__L_EXTENSIONS
_LIBCPP_ALWAYS_INLINE inline
decltype(MB_CUR_MAX) __mb_cur_max_l(locale_t __l)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, _Tp __v)
{
__locale_raii __current(uselocale(__l), uselocale);
return MB_CUR_MAX;
return snprintf_l(__str, __size, 0, __format, __v);
}
#endif // _LIBCPP_LOCALE__L_EXTENSIONS
_LIBCPP_ALWAYS_INLINE inline
wint_t __btowc_l(int __c, locale_t __l)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, int __prec, _Tp __v)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return btowc_l(__c, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return btowc(__c);
#endif
return snprintf_l(__str, __size, 0, __format, __prec, __v);
}
_LIBCPP_ALWAYS_INLINE inline
int __wctob_l(wint_t __c, locale_t __l)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return wctob_l(__c, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return wctob(__c);
#endif
return asprintf_l(__ret, 0, __format, __v);
}
_LIBCPP_ALWAYS_INLINE inline
size_t __wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
size_t __len, mbstate_t *__ps, locale_t __l)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
_Tp __v)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return wcsnrtombs_l(__dest, __src, __nwc, __len, __ps, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
#endif
return asprintf_l(__ret, 0, __format, __prec, __v);
}
_LIBCPP_ALWAYS_INLINE inline
size_t __wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, _Tp* __v)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return wcrtomb_l(__s, __wc, __ps, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return wcrtomb(__s, __wc, __ps);
#endif
return sscanf_l(__str, 0, __format, __v);
}
_LIBCPP_ALWAYS_INLINE inline
size_t __mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
size_t __len, mbstate_t *__ps, locale_t __l)
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isxdigit(int __c)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return mbsnrtowcs_l(__dest, __src, __nms, __len, __ps, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
#endif
return isxdigit_l(__c, 0);
}
_LIBCPP_ALWAYS_INLINE inline
size_t __mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
mbstate_t *__ps, locale_t __l)
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isdigit(int __c)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return mbrtowc_l(__pwc, __s, __n, __ps, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return mbrtowc(__pwc, __s, __n, __ps);
#endif
return isdigit_l(__c, 0);
}
_LIBCPP_ALWAYS_INLINE inline
int __mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
#else // __APPLE__
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, ...)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return mbtowc_l(__pwc, __pmb, __max, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return mbtowc(__pwc, __pmb, __max);
#endif
va_list __ap;
va_start(__ap, __format);
int __result = vsprintf(__str, __format, __ap);
va_end(__ap);
return __result;
}
_LIBCPP_ALWAYS_INLINE inline
size_t __mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, ...)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return mbrlen_l(__s, __n, __ps, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return mbrlen(__s, __n, __ps);
#endif
va_list __ap;
va_start(__ap, __format);
int __result = vsnprintf(__str, __size, __format, __ap);
va_end(__ap);
return __result;
}
_LIBCPP_ALWAYS_INLINE inline
lconv *__localeconv_l(locale_t __l)
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_asprintf(char** __ret,
const char* __restrict __format, ...)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return localeconv_l(__l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return localeconv();
#endif
va_list __ap;
va_start(__ap, __format);
int __result = vasprintf(__ret, __format, __ap);
va_end(__ap);
return __result;
}
_LIBCPP_ALWAYS_INLINE inline
size_t __mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
mbstate_t *__ps, locale_t __l)
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, ...)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return mbsrtowcs_l(__dest, __src, __len, __ps, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return mbsrtowcs(__dest, __src, __len, __ps);
#endif
va_list __ap;
va_start(__ap, __format);
int __result = vsscanf(__str, __format, __ap);
va_end(__ap);
return __result;
}
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isxdigit(int __c)
{
return isxdigit(__c);
}
_LIBCPP_ALWAYS_INLINE inline
int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __res = vsprintf_l(__s, __l, __format, __va);
#else
__locale_raii __current(uselocale(__l), uselocale);
int __res = vsprintf(__s, __format, __va);
#endif
va_end(__va);
return __res;
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isdigit(int __c)
{
return isdigit(__c);
}
_LIBCPP_ALWAYS_INLINE inline
int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __res = vsnprintf_l(__s, __n, __l, __format, __va);
#else
__locale_raii __current(uselocale(__l), uselocale);
int __res = vsnprintf(__s, __n, __format, __va);
#endif
va_end(__va);
return __res;
}
_LIBCPP_ALWAYS_INLINE inline
int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __res = vasprintf_l(__s, __l, __format, __va);
#else
__locale_raii __current(uselocale(__l), uselocale);
int __res = vasprintf(__s, __format, __va);
#endif
va_end(__va);
return __res;
}
_LIBCPP_ALWAYS_INLINE inline
int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __res = vsscanf_l(__s, __l, __format, __va);
#else
__locale_raii __current(uselocale(__l), uselocale);
int __res = vsscanf(__s, __format, __va);
#endif
va_end(__va);
return __res;
}
#endif // __linux__
#endif // __APPLE__
// __scan_keyword
// Scans [__b, __e) until a match is found in the basic_strings range
@@ -814,7 +753,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
int __save_errno = errno;
errno = 0;
char *__p2;
long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
long long __ll = strtoll_l(__a, &__p2, __base, 0);
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -854,7 +793,7 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
int __save_errno = errno;
errno = 0;
char *__p2;
unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -882,7 +821,7 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
if (__a != __a_end)
{
char *__p2;
long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE);
long double __ld = strtold_l(__a, &__p2, 0);
if (__p2 != __a_end)
{
__err = ios_base::failbit;
@@ -1287,11 +1226,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break;
// Stage 3
__a[sizeof(__a)-1] = 0;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
if (sscanf_l(__a, _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
#else
if (__sscanf_l(__a, __cloc(), "%p", &__v) != 1)
#endif
if (__nolocale_sscanf(__a, "%p", &__v) != 1)
__err = ios_base::failbit;
// EOF checked
if (__b == __e)
@@ -1396,13 +1331,13 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
*__oe++ = __ct.widen(*__nf++);
*__oe++ = __ct.widen(*__nf++);
for (__ns = __nf; __ns < __ne; ++__ns)
if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
if (!__nolocale_isxdigit(*__ns))
break;
}
else
{
for (__ns = __nf; __ns < __ne; ++__ns)
if (!isdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
if (!__nolocale_isdigit(*__ns))
break;
}
if (__grouping.empty())
@@ -1600,11 +1535,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1630,11 +1561,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<long long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1660,11 +1587,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<unsigned long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1690,11 +1613,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<unsigned long long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1721,35 +1640,18 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char* __nb = __nar;
int __nc;
if (__specify_precision)
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
__nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
(int)__iob.precision(), __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
(int)__iob.precision(), __v);
#endif
else
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
__nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
#endif
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
unique_ptr<char, void(*)(void*)> __nbh(0, free);
if (__nc > static_cast<int>(__nbuf-1))
{
if (__specify_precision)
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
__nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
#else
__nc = __asprintf_l(&__nb, __cloc(), __fmt,
(int)__iob.precision(), __v);
#endif
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
__v);
else
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
__nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
__nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision(), __v);
#endif
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
if (__nb == 0)
__throw_bad_alloc();
__nbh.reset(__nb);
@@ -1790,35 +1692,18 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char* __nb = __nar;
int __nc;
if (__specify_precision)
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
__nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
(int)__iob.precision(), __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
(int)__iob.precision(), __v);
#endif
else
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
__nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
#endif
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
unique_ptr<char, void(*)(void*)> __nbh(0, free);
if (__nc > static_cast<int>(__nbuf-1))
{
if (__specify_precision)
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
__nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
#else
__nc = __asprintf_l(&__nb, __cloc(), __fmt,
(int)__iob.precision(), __v);
#endif
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
__v);
else
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
__nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
__nc = __asprintf_l(&__nb, __cloc(), __fmt, __v);
#endif
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
if (__nb == 0)
__throw_bad_alloc();
__nbh.reset(__nb);
@@ -1854,11 +1739,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char __fmt[6] = "%p";
const unsigned __nbuf = 20;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar
@@ -2635,7 +2516,11 @@ class __time_put
{
locale_t __loc_;
protected:
_LIBCPP_ALWAYS_INLINE __time_put() : __loc_(_LIBCPP_GET_C_LOCALE) {}
#ifdef _LIBCPP_STABLE_APPLE_ABI
_LIBCPP_ALWAYS_INLINE __time_put() : __loc_(0) {}
#else // _LIBCPP_STABLE_APPLE_ABI
_LIBCPP_ALWAYS_INLINE __time_put() : __loc_(__cloc()) {}
#endif // _LIBCPP_STABLE_APPLE_ABI
__time_put(const char* __nm);
__time_put(const string& __nm);
~__time_put();
@@ -3538,11 +3423,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
// secure memory for digit storage
if (__n > __bs-1)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
__n = asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
#else
__n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
#endif
__n = __nolocale_asprintf(&__bb, "%.0Lf", __units);
if (__bb == 0)
__throw_bad_alloc();
__hn.reset(__bb);
@@ -3693,14 +3574,10 @@ template <class _CharT>
typename messages<_CharT>::catalog
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
{
#if _WIN32
return -1;
#else // _WIN32
catalog __cat = (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
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;
#endif // _WIN32
}
template <class _CharT>
@@ -3708,34 +3585,28 @@ typename messages<_CharT>::string_type
messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
const string_type& __dflt) const
{
#if _WIN32
return __dflt;
#else // _WIN32
string __ndflt;
__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 = (nl_catd)__c;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
string_type __w;
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
__n, __n + strlen(__n));
return __w;
#endif // _WIN32
}
template <class _CharT>
void
messages<_CharT>::do_close(catalog __c) const
{
#if !_WIN32
if (__c != -1)
__c <<= 1;
nl_catd __cat = (nl_catd)__c;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
catclose(__cat);
#endif // !_WIN32
}
extern template class messages<char>;

View File

@@ -773,18 +773,6 @@ public:
map(map&& __m, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
map& operator=(map&& __m)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _VSTD::move(__m.__tree_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
@@ -799,6 +787,14 @@ public:
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
map& operator=(map&& __m)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _VSTD::move(__m.__tree_);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
map& operator=(initializer_list<value_type> __il)
{
@@ -806,7 +802,7 @@ public:
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit map(const allocator_type& __a)
@@ -947,14 +943,10 @@ public:
insert(__e.__i_, *__f);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
@@ -1530,18 +1522,6 @@ public:
multimap(multimap&& __m, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(multimap&& __m)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _VSTD::move(__m.__tree_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
@@ -1556,14 +1536,21 @@ public:
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(multimap&& __m)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _VSTD::move(__m.__tree_);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_multi(__il.begin(), __il.end());
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const allocator_type& __a)
@@ -1692,14 +1679,10 @@ public:
__tree_.__insert_multi(__e.__i_, *__f);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY

View File

@@ -595,7 +595,6 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <limits>
#include <iterator>
#include <__functional_base>
#include <iosfwd>
#if defined(_LIBCPP_NO_EXCEPTIONS)
#include <cassert>
#endif
@@ -1294,7 +1293,7 @@ struct __has_allocate_hint
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
#if !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
template <class _Alloc, class _Tp, class ..._Args>
decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Tp*>(),
@@ -2903,7 +2902,9 @@ public:
long use_count() const _NOEXCEPT {return __shared_count::use_count();}
__shared_weak_count* lock() _NOEXCEPT;
#ifndef _LIBCPP_NO_RTTI
virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
#endif
private:
virtual void __on_zero_shared_weak() _NOEXCEPT = 0;
};
@@ -4147,11 +4148,6 @@ struct _LIBCPP_VISIBLE hash<shared_ptr<_Tp> >
}
};
template<class _CharT, class _Traits, class _Y>
inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p);
//enum class
struct _LIBCPP_VISIBLE pointer_safety
{

View File

@@ -2562,11 +2562,8 @@ subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd,
linear_congruential_engine<result_type, 40014u, 0u, 2147483563u>
__e(__sd == 0u ? default_seed : __sd);
for (size_t __i = 0; __i < __r; ++__i)
{
result_type __e0 = __e();
__x_[__i] = static_cast<result_type>(
(__e0 + ((uint64_t)__e() << 32)) & _Max);
}
(__e() + ((uint64_t)__e() << 32)) & _Max);
__c_ = __x_[__r-1] == 0;
__i_ = 0;
}
@@ -3402,11 +3399,9 @@ public:
// constructors
_LIBCPP_INLINE_VISIBILITY
seed_seq() {}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _Tp>
_LIBCPP_INLINE_VISIBILITY
seed_seq(initializer_list<_Tp> __il) {init(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
@@ -5720,11 +5715,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
param_type(_InputIterator __f, _InputIterator __l)
: __p_(__f, __l) {__init();}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
param_type(initializer_list<double> __wl)
: __p_(__wl.begin(), __wl.end()) {__init();}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _UnaryOperation>
param_type(size_t __nw, double __xmin, double __xmax,
_UnaryOperation __fw);
@@ -5767,11 +5760,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
discrete_distribution(_InputIterator __f, _InputIterator __l)
: __p_(__f, __l) {}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
discrete_distribution(initializer_list<double> __wl)
: __p_(__wl) {}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _UnaryOperation>
_LIBCPP_INLINE_VISIBILITY
discrete_distribution(size_t __nw, double __xmin, double __xmax,
@@ -5951,10 +5942,8 @@ public:
template<class _InputIteratorB, class _InputIteratorW>
param_type(_InputIteratorB __fB, _InputIteratorB __lB,
_InputIteratorW __fW);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _UnaryOperation>
param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _UnaryOperation>
param_type(size_t __nw, result_type __xmin, result_type __xmax,
_UnaryOperation __fw);
@@ -6004,13 +5993,11 @@ public:
_InputIteratorW __fW)
: __p_(__fB, __lB, __fW) {}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _UnaryOperation>
_LIBCPP_INLINE_VISIBILITY
piecewise_constant_distribution(initializer_list<result_type> __bl,
_UnaryOperation __fw)
: __p_(__bl, __fw) {}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _UnaryOperation>
_LIBCPP_INLINE_VISIBILITY
@@ -6140,8 +6127,6 @@ piecewise_constant_distribution<_RealType>::param_type::param_type(
}
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _RealType>
template<class _UnaryOperation>
piecewise_constant_distribution<_RealType>::param_type::param_type(
@@ -6165,8 +6150,6 @@ piecewise_constant_distribution<_RealType>::param_type::param_type(
}
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _RealType>
template<class _UnaryOperation>
piecewise_constant_distribution<_RealType>::param_type::param_type(
@@ -6275,10 +6258,8 @@ public:
template<class _InputIteratorB, class _InputIteratorW>
param_type(_InputIteratorB __fB, _InputIteratorB __lB,
_InputIteratorW __fW);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _UnaryOperation>
param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _UnaryOperation>
param_type(size_t __nw, result_type __xmin, result_type __xmax,
_UnaryOperation __fw);
@@ -6328,13 +6309,11 @@ public:
_InputIteratorW __fW)
: __p_(__fB, __lB, __fW) {}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _UnaryOperation>
_LIBCPP_INLINE_VISIBILITY
piecewise_linear_distribution(initializer_list<result_type> __bl,
_UnaryOperation __fw)
: __p_(__bl, __fw) {}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _UnaryOperation>
_LIBCPP_INLINE_VISIBILITY
@@ -6468,8 +6447,6 @@ piecewise_linear_distribution<_RealType>::param_type::param_type(
}
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _RealType>
template<class _UnaryOperation>
piecewise_linear_distribution<_RealType>::param_type::param_type(
@@ -6493,8 +6470,6 @@ piecewise_linear_distribution<_RealType>::param_type::param_type(
}
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _RealType>
template<class _UnaryOperation>
piecewise_linear_distribution<_RealType>::param_type::param_type(

View File

@@ -2478,14 +2478,12 @@ public:
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
{__parse(__first, __last);}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_regex(initializer_list<value_type> __il,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
{__parse(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~basic_regex() = default;
@@ -2494,11 +2492,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex& operator=(const value_type* __p)
{return assign(__p);}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_regex& operator=(initializer_list<value_type> __il)
{return assign(__il);}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _ST, class _SA>
_LIBCPP_INLINE_VISIBILITY
basic_regex& operator=(const basic_string<value_type, _ST, _SA>& __p)
@@ -2561,15 +2557,11 @@ public:
__parse(__first, __last);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(initializer_list<value_type> __il,
flag_type __f = regex_constants::ECMAScript)
{return assign(__il.begin(), __il.end(), __f);}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// const operations:
_LIBCPP_INLINE_VISIBILITY
unsigned mark_count() const {return __marked_count_;}
@@ -5210,11 +5202,11 @@ public:
const_reference suffix() const {return __suffix_;}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}
const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __matches_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin();}
const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __matches_.end();}
@@ -6077,13 +6069,11 @@ public:
const regex_type& __re, const vector<int>& __submatches,
regex_constants::match_flag_type __m =
regex_constants::match_default);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type& __re,
initializer_list<int> __submatches,
regex_constants::match_flag_type __m =
regex_constants::match_default);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <size_t _N>
regex_token_iterator(_BidirectionalIterator __a,
_BidirectionalIterator __b,
@@ -6172,8 +6162,6 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
__init(__a, __b);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
@@ -6187,8 +6175,6 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
__init(__a, __b);
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _BidirectionalIterator, class _CharT, class _Traits>
template <size_t _N>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::

View File

@@ -437,7 +437,6 @@ public:
set(set&& __s, const allocator_type& __a);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -459,7 +458,6 @@ public:
__tree_.__assign_unique(__il.begin(), __il.end());
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -544,11 +542,9 @@ public:
__tree_.__insert_unique(__e, *__f);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
@@ -775,7 +771,6 @@ public:
multiset(multiset&& __s, const allocator_type& __a);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -797,7 +792,6 @@ public:
__tree_.__assign_multi(__il.begin(), __il.end());
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -882,11 +876,9 @@ public:
__tree_.__insert_multi(__e, *__f);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}

View File

@@ -1150,12 +1150,10 @@ public:
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_string(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
basic_string(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
~basic_string();
@@ -1168,10 +1166,8 @@ public:
#endif
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const_pointer __s) {return assign(__s);}
basic_string& operator=(value_type __c);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY
@@ -1244,9 +1240,7 @@ public:
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const basic_string& __str) {return append(__str);}
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const_pointer __s) {return append(__s);}
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_string& append(const basic_string& __str);
@@ -1269,10 +1263,8 @@ public:
basic_string&
>::type
append(_ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void push_back(value_type __c);
_LIBCPP_INLINE_VISIBILITY
@@ -1308,10 +1300,8 @@ public:
basic_string&
>::type
assign(_ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_string& insert(size_type __pos1, const basic_string& __str);
@@ -1337,11 +1327,9 @@ public:
iterator
>::type
insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, initializer_list<value_type> __il)
{return insert(__pos, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
basic_string& erase(size_type __pos = 0, size_type __n = npos);
_LIBCPP_INLINE_VISIBILITY
@@ -1370,11 +1358,9 @@ public:
basic_string&
>::type
replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
{return replace(__i1, __i2, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
size_type copy(pointer __s, size_type __n, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
@@ -1591,27 +1577,6 @@ private:
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
#endif
_LIBCPP_INLINE_VISIBILITY
void
__move_assign_alloc(basic_string& __str)
_NOEXCEPT_(
!__alloc_traits::propagate_on_container_move_assignment::value ||
is_nothrow_move_assignable<allocator_type>::value)
{__move_assign_alloc(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(basic_string& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(basic_string& __c, false_type)
_NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
@@ -1977,8 +1942,6 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
__init(__first, __last);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il)
@@ -1994,8 +1957,6 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_t
__init(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::~basic_string()
{
@@ -2159,8 +2120,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
{
clear();
shrink_to_fit();
__r_.first() = __str.__r_.first();
__move_assign_alloc(__str);
__r_ = _VSTD::move(__str.__r_);
__str.__zero();
}
@@ -3432,17 +3392,7 @@ _LIBCPP_INLINE_VISIBILITY inline
int
basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
{
size_t __lhs_sz = size();
size_t __rhs_sz = __str.size();
int __result = traits_type::compare(data(), __str.data(),
_VSTD::min(__lhs_sz, __rhs_sz));
if (__result != 0)
return __result;
if (__lhs_sz < __rhs_sz)
return -1;
if (__lhs_sz > __rhs_sz)
return 1;
return 0;
return compare(0, npos, __str.data(), __str.size());
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3557,6 +3507,24 @@ operator==(const _CharT* __lhs,
return __rhs.compare(__lhs) == 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const char* __lhs,
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
{
return strcmp(__lhs, __rhs.data()) == 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const wchar_t* __lhs,
const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __rhs) _NOEXCEPT
{
return wcscmp(__lhs, __rhs.data()) == 0;
}
template<class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
@@ -3566,6 +3534,24 @@ operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
return __lhs.compare(__rhs) == 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
const char* __rhs) _NOEXCEPT
{
return strcmp(__lhs.data(), __rhs) == 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __lhs,
const wchar_t* __rhs) _NOEXCEPT
{
return wcscmp(__lhs.data(), __rhs) == 0;
}
// operator!=
template<class _CharT, class _Traits, class _Allocator>
@@ -3603,7 +3589,25 @@ bool
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
{
return __lhs.compare(__rhs) < 0;
return __lhs.cmpare(__rhs) < 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const basic_string<char, char_traits<char>, _Allocator>& __lhs,
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
{
return strcmp(__lhs.data(), __rhs.data()) < 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __lhs,
const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __rhs) _NOEXCEPT
{
return wcscmp(__lhs.data(), __rhs.data()) < 0;
}
template<class _CharT, class _Traits, class _Allocator>
@@ -3612,7 +3616,25 @@ bool
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
{
return __lhs.compare(__rhs) < 0;
return __lhs.compare(__rhs);
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const basic_string<char, char_traits<char>, _Allocator>& __lhs,
const char* __rhs) _NOEXCEPT
{
return strcmp(__lhs.data(), __rhs) < 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __lhs,
const wchar_t* __rhs) _NOEXCEPT
{
return wcscmp(__lhs.data(), __rhs) < 0;
}
template<class _CharT, class _Traits, class _Allocator>
@@ -3624,6 +3646,24 @@ operator< (const _CharT* __lhs,
return __rhs.compare(__lhs) > 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const char* __lhs,
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
{
return strcmp(__lhs, __rhs.data()) < 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const wchar_t* __lhs,
const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __rhs) _NOEXCEPT
{
return wcscmp(__lhs, __rhs.data()) < 0;
}
// operator>
template<class _CharT, class _Traits, class _Allocator>
@@ -3897,21 +3937,6 @@ template<class _CharT, class _Traits, class _Allocator>
const typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::npos;
template<class _Ptr>
size_t _LIBCPP_INLINE_VISIBILITY __do_string_hash(_Ptr __p, _Ptr __e)
{
size_t __r = 0;
const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t __m = size_t(0xF) << (__sr + 4);
for (; __p != __e; ++__p)
{
__r = (__r << 4) + *__p;
size_t __g = __r & __m;
__r ^= __g | (__g >> __sr);
}
return __r;
}
template<class _CharT, class _Traits, class _Allocator>
struct _LIBCPP_VISIBLE hash<basic_string<_CharT, _Traits, _Allocator> >
: public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>
@@ -3925,46 +3950,22 @@ size_t
hash<basic_string<_CharT, _Traits, _Allocator> >::operator()(
const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT
{
return __do_string_hash(__val.data(), __val.data() + __val.size());
typedef basic_string<_CharT, _Traits, _Allocator> S;
typedef typename S::const_pointer const_pointer;
size_t __r = 0;
const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t __m = size_t(0xF) << (__sr + 4);
const_pointer __p = __val.data();
const_pointer __e = __p + __val.size();
for (; __p != __e; ++__p)
{
__r = (__r << 4) + *__p;
size_t __g = __r & __m;
__r ^= __g | (__g >> __sr);
}
return __r;
}
template<class _CharT, class _Traits, class _Allocator>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const basic_string<_CharT, _Traits, _Allocator>& __str);
template<class _CharT, class _Traits, class _Allocator>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
template<class _CharT, class _Traits, class _Allocator>
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
extern template class basic_string<char>;
extern template class basic_string<wchar_t>;

View File

@@ -1,110 +0,0 @@
// -*- C++ -*-
//===--------------------- support/win32/locale_win32.h -------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
// ctype mask table defined in msvcrt.dll
extern "C" unsigned short __declspec(dllimport) _ctype[];
#include "support/win32/support.h"
#include <memory>
#include <xlocinfo.h> // _locale_t
#define locale_t _locale_t
#define LC_COLLATE_MASK _M_COLLATE
#define LC_CTYPE_MASK _M_CTYPE
#define LC_MONETARY_MASK _M_MONETARY
#define LC_NUMERIC_MASK _M_NUMERIC
#define LC_TIME_MASK _M_TIME
#define LC_MESSAGES_MASK _M_MESSAGES
#define LC_ALL_MASK ( LC_COLLATE_MASK \
| LC_CTYPE_MASK \
| LC_MESSAGES_MASK \
| LC_MONETARY_MASK \
| LC_NUMERIC_MASK \
| LC_TIME_MASK )
#define freelocale _free_locale
// FIXME: base currently unused. Needs manual work to construct the new locale
locale_t newlocale( int mask, const char * locale, locale_t base );
locale_t uselocale( locale_t newloc );
lconv *localeconv_l( locale_t loc );
size_t mbrlen_l( const char *__restrict__ s, size_t n,
mbstate_t *__restrict__ ps, locale_t loc);
size_t mbsrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t len, mbstate_t *__restrict__ ps, locale_t loc );
size_t wcrtomb_l( char *__restrict__ s, wchar_t wc, mbstate_t *__restrict__ ps,
locale_t loc);
size_t mbrtowc_l( wchar_t *__restrict__ pwc, const char *__restrict__ s,
size_t n, mbstate_t *__restrict__ ps, locale_t loc);
size_t mbsnrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t nms, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
size_t wcsnrtombs_l( char *__restrict__ dst, const wchar_t **__restrict__ src,
size_t nwc, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
wint_t btowc_l( int c, locale_t loc );
int wctob_l( wint_t c, locale_t loc );
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
_LIBCPP_ALWAYS_INLINE inline
decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
{
__locale_raii __current( uselocale(__l), uselocale );
return MB_CUR_MAX;
}
// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
#include <stdio.h>
#define mbtowc_l _mbtowc_l
#define strtoll_l _strtoi64_l
#define strtoull_l _strtoui64_l
// FIXME: current msvcrt does not know about long double
#define strtold_l _strtod_l
#define islower_l _islower_l
#define isupper_l _isupper_l
#define isdigit_l _isdigit_l
#define isxdigit_l _isxdigit_l
#define strcoll_l _strcoll_l
#define strxfrm_l _strxfrm_l
#define wcscoll_l _wcscoll_l
#define wcsxfrm_l _wcsxfrm_l
#define toupper_l _toupper_l
#define tolower_l _tolower_l
#define iswspace_l _iswspace_l
#define iswprint_l _iswprint_l
#define iswcntrl_l _iswcntrl_l
#define iswupper_l _iswupper_l
#define iswlower_l _iswlower_l
#define iswalpha_l _iswalpha_l
#define iswdigit_l _iswdigit_l
#define iswpunct_l _iswpunct_l
#define iswxdigit_l _iswxdigit_l
#define towupper_l _towupper_l
#define towlower_l _towlower_l
#define strftime_l _strftime_l
#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
#define snprintf_l( __s, __n, __l, __f, ... ) _snprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
int asprintf_l( char **ret, locale_t loc, const char *format, ... );
int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap );
// not-so-pressing FIXME: use locale to determine blank characters
inline int isblank_l( int c, locale_t /*loc*/ )
{
return ( c == ' ' || c == '\t' );
}
inline int iswblank_l( wint_t c, locale_t /*loc*/ )
{
return ( c == L' ' || c == L'\t' );
}
#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H

View File

@@ -1,31 +0,0 @@
// -*- C++ -*-
//===----------------------- support/win32/support.h ----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_SUPPORT_H
#define _LIBCPP_SUPPORT_WIN32_SUPPORT_H
/*
Functions and constants used in libc++ that are missing from the Windows C library.
*/
#include <wchar.h> // mbstate_t
#include <stdio.h> // _snwprintf
#define swprintf _snwprintf
#define vswprintf _vsnwprintf
int vasprintf( char **sptr, const char *__restrict__ fmt , va_list ap );
int asprintf(char **sptr, const char *__restrict__ fmt, ...);
size_t mbsnrtowcs( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t nmc, size_t len, mbstate_t *__restrict__ ps );
size_t wcsnrtombs( char *__restrict__ dst, const wchar_t **__restrict__ src,
size_t nwc, size_t len, mbstate_t *__restrict__ ps );
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H

View File

@@ -639,6 +639,11 @@ tie(_Tp&... __t)
template <class _Up>
struct __ignore_t
{
_LIBCPP_INLINE_VISIBILITY
__ignore_t() {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
__ignore_t(_Tp&&) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
const __ignore_t& operator=(_Tp&&) const {return *this;}

View File

@@ -725,7 +725,7 @@ template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
// is_base_of
#ifdef _LIBCP_HAS_IS_BASE_OF
#if __has_feature(is_base_of)
template <class _Bp, class _Dp>
struct _LIBCPP_VISIBLE is_base_of
@@ -733,7 +733,51 @@ struct _LIBCPP_VISIBLE is_base_of
#else // __has_feature(is_base_of)
#error is_base_of not implemented.
// (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
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
template <class _Bp, class _Dp>
struct __is_base_of_tests
{
template <class _Tp>
static char __test(const volatile _Dp*, _Tp);
static __two __test(const volatile _Bp*, int);
};
template <class _Bp, class _Dp>
struct __is_base_of_imp
{
struct __host
{
operator const volatile _Bp*() const;
operator const volatile _Dp*();
};
static const size_t __complete_check = sizeof(_Dp);
static const bool value = sizeof(__is_base_of_tests<_Bp, _Dp>::__test(__host(), 0)) == 1;
};
template <class _Bp, class _Dp, bool = is_class<_Bp>::value,
bool = is_class<_Dp>::value,
bool = is_same<_Bp, _Dp>::value>
struct __libcpp_base_of : public false_type {};
template <class _Bp, class _Dp>
struct __libcpp_base_of<_Bp, _Dp, true, true, true> : public true_type {};
template <class _Bp, class _Dp>
struct __libcpp_base_of<_Bp, _Dp, true, true, false>
: public integral_constant<bool, __is_base_of_imp<_Bp, _Dp>::value> {};
template <class _Bp, class _Dp>
struct _LIBCPP_VISIBLE is_base_of
: public __libcpp_base_of<typename remove_cv<_Bp>::type, typename remove_cv<_Dp>::type>
{
};
#endif // __has_feature(is_base_of)
@@ -2970,15 +3014,11 @@ struct __invoke_of
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
typename enable_if
<
is_move_constructible<_Tp>::value &&
is_move_assignable<_Tp>::value
>::type
#else
void
#endif
swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
is_nothrow_move_assignable<_Tp>::value)
{
@@ -3052,26 +3092,6 @@ struct __is_nothrow_swappable
#endif // __has_feature(cxx_noexcept)
#ifdef _LIBCXX_UNDERLYING_TYPE
template <class _Tp>
struct underlying_type
{
typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type;
};
#else // _LIBCXX_UNDERLYING_TYPE
template <class _Tp, bool _Support = false>
struct underlying_type
{
static_assert(_Support, "The underyling_type trait requires compiler "
"support. Either no such support exists or "
"libc++ does not know how to use it.");
};
#endif // _LIBCXX_UNDERLYING_TYPE
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_TYPE_TRAITS

View File

@@ -560,9 +560,9 @@ public:
typedef const value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
rebind<value_type>
#else
rebind<const value_type>::other
rebind<value_type>::other
#endif
pointer;
@@ -684,14 +684,12 @@ public:
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
unordered_map(unordered_map&& __u, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_map(initializer_list<value_type> __il);
unordered_map(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
unordered_map(initializer_list<value_type> __il, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~unordered_map() = default;
_LIBCPP_INLINE_VISIBILITY
unordered_map& operator=(const unordered_map& __u)
@@ -703,9 +701,7 @@ public:
unordered_map& operator=(unordered_map&& __u)
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_map& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -792,11 +788,9 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
@@ -992,8 +986,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
initializer_list<value_type> __il)
@@ -1021,8 +1013,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
insert(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -1037,8 +1027,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
@@ -1049,8 +1037,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -1306,7 +1292,6 @@ public:
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_multimap(initializer_list<value_type> __il);
unordered_multimap(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(),
@@ -1314,7 +1299,6 @@ public:
unordered_multimap(initializer_list<value_type> __il, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~unordered_multimap() = default;
_LIBCPP_INLINE_VISIBILITY
unordered_multimap& operator=(const unordered_multimap& __u)
@@ -1326,9 +1310,7 @@ public:
unordered_multimap& operator=(unordered_multimap&& __u)
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_multimap& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -1411,11 +1393,9 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
@@ -1602,8 +1582,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
initializer_list<value_type> __il)
@@ -1631,8 +1609,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
insert(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -1647,8 +1623,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multima
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
@@ -1659,8 +1633,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS

View File

@@ -365,7 +365,6 @@ public:
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
unordered_set(unordered_set&& __u, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_set(initializer_list<value_type> __il);
unordered_set(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(),
@@ -373,7 +372,6 @@ public:
unordered_set(initializer_list<value_type> __il, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~unordered_set() = default;
_LIBCPP_INLINE_VISIBILITY
unordered_set& operator=(const unordered_set& __u)
@@ -385,9 +383,7 @@ public:
unordered_set& operator=(unordered_set&& __u)
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_set& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -441,11 +437,9 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p);}
@@ -613,8 +607,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
initializer_list<value_type> __il)
@@ -642,8 +634,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
insert(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -658,8 +648,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
unordered_set<_Value, _Hash, _Pred, _Alloc>&
@@ -670,8 +658,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -777,7 +763,6 @@ public:
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_multiset(initializer_list<value_type> __il);
unordered_multiset(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(),
@@ -785,7 +770,6 @@ public:
unordered_multiset(initializer_list<value_type> __il, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~unordered_multiset() = default;
_LIBCPP_INLINE_VISIBILITY
unordered_multiset& operator=(const unordered_multiset& __u)
@@ -797,9 +781,7 @@ public:
unordered_multiset& operator=(unordered_multiset&& __u)
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_multiset& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -851,11 +833,9 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p);}
@@ -1024,8 +1004,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
initializer_list<value_type> __il)
@@ -1053,8 +1031,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
insert(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -1070,8 +1046,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
@@ -1082,8 +1056,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY

View File

@@ -226,12 +226,9 @@ struct _LIBCPP_VISIBLE pair
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(const pair<_U1, _U2>& __p
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
,typename enable_if<is_constructible<_T1, _U1>::value &&
is_constructible<_T2, _U2>::value>::type* = 0
#endif
)
pair(const pair<_U1, _U2>& __p,
typename enable_if<is_constructible<_T1, _U1>::value &&
is_constructible<_T2, _U2>::value>::type* = 0)
: first(__p.first), second(__p.second) {}
_LIBCPP_INLINE_VISIBILITY

View File

@@ -798,10 +798,8 @@ public:
valarray(const valarray& __v);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
valarray(valarray&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
valarray(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
valarray(const slice_array<value_type>& __sa);
valarray(const gslice_array<value_type>& __ga);
valarray(const mask_array<value_type>& __ma);
@@ -812,17 +810,13 @@ public:
valarray& operator=(const valarray& __v);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
valarray& operator=(valarray&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
valarray& operator=(initializer_list<value_type>);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
valarray& operator=(const value_type& __x);
valarray& operator=(const slice_array<value_type>& __sa);
valarray& operator=(const gslice_array<value_type>& __ga);
valarray& operator=(const mask_array<value_type>& __ma);
valarray& operator=(const indirect_array<value_type>& __ia);
template <class _ValExpr>
valarray& operator=(const __val_expr<_ValExpr>& __v);
// element access:
_LIBCPP_INLINE_VISIBILITY
@@ -2712,10 +2706,6 @@ valarray<_Tp>::valarray(valarray&& __v)
__v.__begin_ = __v.__end_ = nullptr;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp>
valarray<_Tp>::valarray(initializer_list<value_type> __il)
: __begin_(0),
@@ -2742,7 +2732,7 @@ valarray<_Tp>::valarray(initializer_list<value_type> __il)
}
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
@@ -2892,10 +2882,6 @@ valarray<_Tp>::operator=(valarray&& __v)
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
valarray<_Tp>&
@@ -2907,7 +2893,7 @@ valarray<_Tp>::operator=(initializer_list<value_type> __il)
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -2972,21 +2958,6 @@ valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
return *this;
}
template <class _Tp>
template <class _ValExpr>
inline _LIBCPP_INLINE_VISIBILITY
valarray<_Tp>&
valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
{
size_t __n = __v.size();
if (size() != __n)
resize(__n);
value_type* __t = __begin_;
for (size_t __i = 0; __i != __n; ++__t, ++__i)
*__t = result_type(__v[__i]);
return *this;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__val_expr<__slice_expr<const valarray<_Tp>&> >

View File

@@ -160,7 +160,7 @@ public:
vector()
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit vector(const allocator_type&);
explicit vector(const allocator_type& = allocator_type());
explicit vector(size_type n, const value_type& value = value_type(), const allocator_type& = allocator_type());
template <class InputIterator>
vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
@@ -269,6 +269,9 @@ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y)
#include <cstring>
#include <__split_buffer>
#include <__functional_base>
#if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_NO_EXCEPTIONS)
#include <cassert>
#endif
#pragma GCC system_header
@@ -399,14 +402,14 @@ private:
{}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__vector_base& __c, true_type)
void __move_assign_alloc(const __vector_base& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__vector_base& __c, false_type)
void __move_assign_alloc(const __vector_base& __c, false_type)
_NOEXCEPT
{}
@@ -486,26 +489,32 @@ public:
typedef typename __base::difference_type difference_type;
typedef typename __base::pointer pointer;
typedef typename __base::const_pointer const_pointer;
#ifdef _LIBCPP_DEBUG
typedef __debug_iter<vector, pointer> iterator;
typedef __debug_iter<vector, const_pointer> const_iterator;
friend class __debug_iter<vector, pointer>;
friend class __debug_iter<vector, const_pointer>;
pair<iterator*, const_iterator*> __iterator_list_;
_LIBCPP_INLINE_VISIBILITY iterator*& __get_iterator_list(iterator*) {return __iterator_list_.first;}
_LIBCPP_INLINE_VISIBILITY const_iterator*& __get_iterator_list(const_iterator*) {return __iterator_list_.second;}
#elif defined(_LIBCPP_RAW_ITERATORS)
typedef pointer iterator;
typedef const_pointer const_iterator;
#else // defined(_LIBCPP_RAW_ITERATORS)
typedef __wrap_iter<pointer> iterator;
typedef __wrap_iter<const_pointer> const_iterator;
#endif // defined(_LIBCPP_RAW_ITERATORS)
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
vector()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
}
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a)
: __base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
}
{}
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a) : __base(__a) {}
explicit vector(size_type __n);
vector(size_type __n, const_reference __x);
vector(size_type __n, const_reference __x, const allocator_type& __a);
@@ -523,18 +532,13 @@ public:
template <class _ForwardIterator>
vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
vector(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
vector(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#if _LIBCPP_DEBUG_LEVEL >= 2
#ifdef _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY
~vector()
{
__get_db()->__erase_c(this);
}
~vector() {__invalidate_all_iterators();}
#endif
vector(const vector& __x);
@@ -553,11 +557,9 @@ public:
__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
vector& operator=(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end()); return *this;}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _InputIterator>
typename enable_if
@@ -576,11 +578,9 @@ public:
assign(_ForwardIterator __first, _ForwardIterator __last);
void assign(size_type __n, const_reference __u);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -635,26 +635,10 @@ public:
reference at(size_type __n);
const_reference at(size_type __n) const;
_LIBCPP_INLINE_VISIBILITY reference front()
{
_LIBCPP_ASSERT(!empty(), "front() called for empty vector");
return *this->__begin_;
}
_LIBCPP_INLINE_VISIBILITY const_reference front() const
{
_LIBCPP_ASSERT(!empty(), "front() called for empty vector");
return *this->__begin_;
}
_LIBCPP_INLINE_VISIBILITY reference back()
{
_LIBCPP_ASSERT(!empty(), "back() called for empty vector");
return *(this->__end_ - 1);
}
_LIBCPP_INLINE_VISIBILITY const_reference back() const
{
_LIBCPP_ASSERT(!empty(), "back() called for empty vector");
return *(this->__end_ - 1);
}
_LIBCPP_INLINE_VISIBILITY reference front() {return *this->__begin_;}
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return *this->__begin_;}
_LIBCPP_INLINE_VISIBILITY reference back() {return *(this->__end_ - 1);}
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(this->__end_ - 1);}
_LIBCPP_INLINE_VISIBILITY
value_type* data() _NOEXCEPT
@@ -697,21 +681,16 @@ public:
iterator
>::type
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __position, initializer_list<value_type> __il)
{return insert(__position, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
iterator erase(const_iterator __first, const_iterator __last);
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT
{
__base::clear();
__invalidate_all_iterators();
}
{__base::clear();}
void resize(size_type __sz);
void resize(size_type __sz, const_reference __x);
@@ -722,15 +701,6 @@ public:
bool __invariants() const;
#if _LIBCPP_DEBUG_LEVEL >= 2
bool __dereferenceable(const const_iterator* __i) const;
bool __decrementable(const const_iterator* __i) const;
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
#endif // _LIBCPP_DEBUG_LEVEL >= 2
private:
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
void allocate(size_type __n);
@@ -758,26 +728,6 @@ private:
void __move_assign(vector& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
void __move_assign(vector& __c, false_type);
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(const_pointer __new_last) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __p = __c->end_; __p != __c->beg_; )
{
--__p;
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
if (__i->base() > __new_last)
{
(*__p)->__c_ = nullptr;
if (--__c->end_ != __p)
memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
}
}
__get_db()->unlock();
#endif
__base::__destruct_at_end(__new_last);
}
};
template <class _Tp, class _Allocator>
@@ -835,6 +785,7 @@ vector<_Tp, _Allocator>::deallocate() _NOEXCEPT
{
clear();
__alloc_traits::deallocate(this->__alloc(), this->__begin_, capacity());
__invalidate_all_iterators();
this->__begin_ = this->__end_ = this->__end_cap() = 0;
}
}
@@ -843,7 +794,7 @@ template <class _Tp, class _Allocator>
typename vector<_Tp, _Allocator>::size_type
vector<_Tp, _Allocator>::max_size() const _NOEXCEPT
{
return _VSTD::min<size_type>(__alloc_traits::max_size(this->__alloc()), numeric_limits<size_type>::max() / 2); // end() >= begin(), always
return _VSTD::min(__alloc_traits::max_size(this->__alloc()), numeric_limits<size_type>::max() / 2); // end() >= begin(), always
}
// Precondition: __new_size > capacity()
@@ -858,7 +809,7 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
const size_type __cap = capacity();
if (__cap >= __ms / 2)
return __ms;
return _VSTD::max<size_type>(2*__cap, __new_size);
return _VSTD::max(2*__cap, __new_size);
}
// Default constructs __n objects starting at __end_
@@ -970,9 +921,6 @@ vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x)
template <class _Tp, class _Allocator>
vector<_Tp, _Allocator>::vector(size_type __n)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
if (__n > 0)
{
allocate(__n);
@@ -983,9 +931,6 @@ vector<_Tp, _Allocator>::vector(size_type __n)
template <class _Tp, class _Allocator>
vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
if (__n > 0)
{
allocate(__n);
@@ -997,9 +942,6 @@ template <class _Tp, class _Allocator>
vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x, const allocator_type& __a)
: __base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
if (__n > 0)
{
allocate(__n);
@@ -1013,9 +955,6 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value>::type*)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
for (; __first != __last; ++__first)
push_back(*__first);
}
@@ -1027,9 +966,6 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c
!__is_forward_iterator<_InputIterator>::value>::type*)
: __base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
for (; __first != __last; ++__first)
push_back(*__first);
}
@@ -1039,9 +975,6 @@ template <class _ForwardIterator>
vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
if (__n > 0)
{
@@ -1056,9 +989,6 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __las
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)
: __base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
if (__n > 0)
{
@@ -1071,9 +1001,6 @@ template <class _Tp, class _Allocator>
vector<_Tp, _Allocator>::vector(const vector& __x)
: __base(__alloc_traits::select_on_container_copy_construction(__x.__alloc()))
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
size_type __n = __x.size();
if (__n > 0)
{
@@ -1086,9 +1013,6 @@ template <class _Tp, class _Allocator>
vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a)
: __base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
size_type __n = __x.size();
if (__n > 0)
{
@@ -1105,14 +1029,11 @@ vector<_Tp, _Allocator>::vector(vector&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __base(_VSTD::move(__x.__alloc()))
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
__get_db()->swap(this, &__x);
#endif
this->__begin_ = __x.__begin_;
this->__end_ = __x.__end_;
this->__end_cap() = __x.__end_cap();
__x.__begin_ = __x.__end_ = __x.__end_cap() = 0;
__x.__invalidate_all_iterators();
}
template <class _Tp, class _Allocator>
@@ -1120,18 +1041,13 @@ _LIBCPP_INLINE_VISIBILITY inline
vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
: __base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
if (__a == __x.__alloc())
{
this->__begin_ = __x.__begin_;
this->__end_ = __x.__end_;
this->__end_cap() = __x.__end_cap();
__x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->swap(this, &__x);
#endif
__x.__invalidate_all_iterators();
}
else
{
@@ -1140,15 +1056,10 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
}
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
if (__il.size() > 0)
{
allocate(__il.size());
@@ -1161,9 +1072,6 @@ _LIBCPP_INLINE_VISIBILITY inline
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
: __base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
if (__il.size() > 0)
{
allocate(__il.size());
@@ -1171,8 +1079,6 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocat
}
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
vector<_Tp, _Allocator>&
@@ -1210,9 +1116,6 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
this->__end_cap() = __c.__end_cap();
__base::__move_assign_alloc(__c);
__c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->swap(this, &__c);
#endif
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1305,7 +1208,7 @@ _LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
#ifdef _LIBCPP_DEBUG
return iterator(this, __p);
#else
return iterator(__p);
@@ -1317,7 +1220,7 @@ _LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::const_iterator
vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
#ifdef _LIBCPP_DEBUG
return const_iterator(this, __p);
#else
return const_iterator(__p);
@@ -1361,7 +1264,9 @@ _LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::reference
vector<_Tp, _Allocator>::operator[](size_type __n)
{
_LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");
#ifdef _LIBCPP_DEBUG
assert(__n < size());
#endif
return this->__begin_[__n];
}
@@ -1370,7 +1275,9 @@ _LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::const_reference
vector<_Tp, _Allocator>::operator[](size_type __n) const
{
_LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");
#ifdef _LIBCPP_DEBUG
assert(__n < size());
#endif
return this->__begin_[__n];
}
@@ -1498,7 +1405,6 @@ _LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::pop_back()
{
_LIBCPP_ASSERT(!empty(), "vector::pop_back called for empty vector");
this->__destruct_at_end(this->__end_ - 1);
}
@@ -1507,11 +1413,6 @@ _LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::erase(const_iterator __position)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
"vector::erase(iterator) called with an iterator not"
" referring to this vector");
#endif
pointer __p = const_cast<pointer>(&*__position);
iterator __r = __make_iter(__p);
this->__destruct_at_end(_VSTD::move(__p + 1, this->__end_, __p));
@@ -1522,12 +1423,6 @@ template <class _Tp, class _Allocator>
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
"vector::erase(iterator, iterator) called with an iterator not"
" referring to this vector");
#endif
_LIBCPP_ASSERT(__first <= __last, "vector::erase(first, last) called with invalid range");
pointer __p = this->__begin_ + (__first - begin());
iterator __r = __make_iter(__p);
this->__destruct_at_end(_VSTD::move(__p + (__last - __first), this->__end_, __p));
@@ -1551,11 +1446,6 @@ template <class _Tp, class _Allocator>
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
"vector::insert(iterator, x) called with an iterator not"
" referring to this vector");
#endif
pointer __p = this->__begin_ + (__position - begin());
if (this->__end_ < this->__end_cap())
{
@@ -1590,11 +1480,6 @@ template <class _Tp, class _Allocator>
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
"vector::insert(iterator, x) called with an iterator not"
" referring to this vector");
#endif
pointer __p = this->__begin_ + (__position - begin());
if (this->__end_ < this->__end_cap())
{
@@ -1628,11 +1513,6 @@ template <class... _Args>
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
"vector::emplace(iterator, x) called with an iterator not"
" referring to this vector");
#endif
pointer __p = this->__begin_ + (__position - begin());
if (this->__end_ < this->__end_cap())
{
@@ -1666,11 +1546,6 @@ template <class _Tp, class _Allocator>
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
"vector::insert(iterator, n, x) called with an iterator not"
" referring to this vector");
#endif
pointer __p = this->__begin_ + (__position - begin());
if (__n > 0)
{
@@ -1714,11 +1589,6 @@ typename enable_if
>::type
vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
"vector::insert(iterator, range) called with an iterator not"
" referring to this vector");
#endif
difference_type __off = __position - begin();
pointer __p = this->__begin_ + __off;
allocator_type& __a = this->__alloc();
@@ -1752,8 +1622,8 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs
#endif // _LIBCPP_NO_EXCEPTIONS
}
__p = _VSTD::rotate(__p, __old_last, this->__end_);
insert(__make_iter(__p), make_move_iterator(__v.begin()),
make_move_iterator(__v.end()));
insert(__make_iter(__p), move_iterator<iterator>(__v.begin()),
move_iterator<iterator>(__v.end()));
return begin() + __off;
}
@@ -1766,11 +1636,6 @@ typename enable_if
>::type
vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
"vector::insert(iterator, range) called with an iterator not"
" referring to this vector");
#endif
pointer __p = this->__begin_ + (__position - begin());
difference_type __n = _VSTD::distance(__first, __last);
if (__n > 0)
@@ -1833,17 +1698,14 @@ vector<_Tp, _Allocator>::swap(vector& __x)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value)
{
_LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value ||
this->__alloc() == __x.__alloc(),
"vector::swap: Either propagate_on_container_swap must be true"
" or the allocators must compare equal");
_VSTD::swap(this->__begin_, __x.__begin_);
_VSTD::swap(this->__end_, __x.__end_);
_VSTD::swap(this->__end_cap(), __x.__end_cap());
__base::__swap_alloc(this->__alloc(), __x.__alloc());
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->swap(this, &__x);
#endif // _LIBCPP_DEBUG_LEVEL >= 2
#ifdef _LIBCPP_DEBUG
iterator::swap(this, &__x);
const_iterator::swap(this, &__x);
#endif // _LIBCPP_DEBUG
}
template <class _Tp, class _Allocator>
@@ -1867,48 +1729,17 @@ vector<_Tp, _Allocator>::__invariants() const
return true;
}
#if _LIBCPP_DEBUG_LEVEL >= 2
template <class _Tp, class _Allocator>
bool
vector<_Tp, _Allocator>::__dereferenceable(const const_iterator* __i) const
{
return this->__begin_ <= __i->base() && __i->base() < this->__end_;
}
template <class _Tp, class _Allocator>
bool
vector<_Tp, _Allocator>::__decrementable(const const_iterator* __i) const
{
return this->__begin_ < __i->base() && __i->base() <= this->__end_;
}
template <class _Tp, class _Allocator>
bool
vector<_Tp, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const
{
const_pointer __p = __i->base() + __n;
return this->__begin_ <= __p && __p <= this->__end_;
}
template <class _Tp, class _Allocator>
bool
vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{
const_pointer __p = __i->base() + __n;
return this->__begin_ <= __p && __p < this->__end_;
}
#endif // _LIBCPP_DEBUG_LEVEL >= 2
template <class _Tp, class _Allocator>
#ifndef _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY inline
#endif
void
vector<_Tp, _Allocator>::__invalidate_all_iterators()
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__invalidate_all(this);
#endif // _LIBCPP_DEBUG_LEVEL >= 2
#ifdef _LIBCPP_DEBUG
iterator::__remove_all(this);
const_iterator::__remove_all(this);
#endif // _LIBCPP_DEBUG
}
// vector<bool>
@@ -2023,10 +1854,8 @@ public:
vector(const vector& __v);
vector(const vector& __v, const allocator_type& __a);
vector& operator=(const vector& __v);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
vector(initializer_list<value_type> __il);
vector(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -2039,11 +1868,9 @@ public:
__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
vector& operator=(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end()); return *this;}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _InputIterator>
typename enable_if
@@ -2062,11 +1889,9 @@ public:
assign(_ForwardIterator __first, _ForwardIterator __last);
void assign(size_type __n, const value_type& __x);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT
{return allocator_type(this->__alloc());}
@@ -2154,11 +1979,9 @@ public:
iterator
>::type
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __position, initializer_list<value_type> __il)
{return insert(__position, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
iterator erase(const_iterator __first, const_iterator __last);
@@ -2244,14 +2067,14 @@ private:
{__move_assign_alloc(__c, integral_constant<bool,
__storage_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(vector& __c, true_type)
void __move_assign_alloc(const vector& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(vector& __c, false_type)
void __move_assign_alloc(const vector& __c, false_type)
_NOEXCEPT
{}
@@ -2528,8 +2351,6 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la
}
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Allocator>
vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
: __begin_(0),
@@ -2558,8 +2379,6 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const alloca
}
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Allocator>
vector<bool, _Allocator>::~vector()
{

View File

@@ -1,17 +1,9 @@
# Get sources
file(GLOB sources ../src/*.cpp)
if(WIN32)
file(GLOB win32_sources ../src/support/win32/*.cpp)
list(APPEND sources ${win32_sources})
endif()
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/*)
if(WIN32)
file( GLOB win32_headers ../include/support/win32/*.h)
list(APPEND headers ${win32_headers})
endif()
# 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)

View File

@@ -26,7 +26,7 @@ if [ -z $MACOSX_DEPLOYMENT_TARGET ]
then
if [ -z $IPHONEOS_DEPLOYMENT_TARGET ]
then
MACOSX_DEPLOYMENT_TARGET=10.7
MACOSX_DEPLOYMENT_TARGET=10.6
fi
fi
@@ -35,7 +35,7 @@ then
RC_ProjectSourceVersion=1
fi
EXTRA_FLAGS="-std=c++0x"
EXTRA_FLAGS="-std=c++0x "
case $TRIPLE in
*-apple-*)
@@ -70,23 +70,14 @@ case $TRIPLE in
fi
LDSHARED_FLAGS="-o libc++.1.dylib \
-dynamiclib -nodefaultlibs \
-current_version ${RC_ProjectSourceVersion} \
-compatibility_version 1 \
-current_version ${RC_ProjectSourceVersion} -compatibility_version 1 \
-install_name /usr/lib/libc++.1.dylib \
-lSystem \
-Wl,-unexported_symbols_list,libc++unexp.exp \
${RE_EXPORT_LINE} \
-Wl,-force_symbols_not_weak_list,notweak.exp \
-Wl,-force_symbols_weak_list,weak.exp"
-Wl,-force_symbols_not_weak_list,notweak.exp "
fi
;;
*-*-mingw*)
# FIXME: removing libgcc and libsupc++ dependencies means porting libcxxrt and LLVM/compiler-rt
SOEXT=dll
LDSHARED_FLAGS="-o libc++.dll \
-shared -nodefaultlibs -Wl,--export-all-symbols -Wl,--allow-multiple-definition -Wl,--out-implib,libc++.dll.a \
-lsupc++ -lpthread -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcr100 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt"
;;
*)
RC_CFLAGS="-fPIC"
SOEXT=so
@@ -106,13 +97,8 @@ set -x
for FILE in ../src/*.cpp; do
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -nostdinc++ -I../include $FILE
done
case $TRIPLE in
*-*-mingw*)
for FILE in ../src/support/win32/*.cpp; do
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -nostdinc++ -I../include $FILE
done
;;
esac
$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS
#libtool -static -o libc++.a *.o

View File

@@ -1,16 +0,0 @@
__ZTISt10bad_typeid
__ZTISt11logic_error
__ZTISt11range_error
__ZTISt12domain_error
__ZTISt12length_error
__ZTISt12out_of_range
__ZTISt13bad_exception
__ZTISt13runtime_error
__ZTISt14overflow_error
__ZTISt15underflow_error
__ZTISt16invalid_argument
__ZTISt16nested_exception
__ZTISt20bad_array_new_length
__ZTISt8bad_cast
__ZTISt9bad_alloc
__ZTISt9exception

View File

@@ -1,484 +0,0 @@
//===-------------------------- debug.cpp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#define _LIBCPP_DEBUG2 1
#include "__config"
#include "__debug"
#include "functional"
#include "algorithm"
#include "__hash_table"
#include "mutex"
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_VISIBLE
__libcpp_db*
__get_db()
{
static __libcpp_db db;
return &db;
};
_LIBCPP_VISIBLE
const __libcpp_db*
__get_const_db()
{
return __get_db();
}
namespace
{
typedef mutex mutex_type;
typedef lock_guard<mutex_type> WLock;
typedef lock_guard<mutex_type> RLock;
mutex_type&
mut()
{
static mutex_type m;
return m;
}
} // unnamed namespace
__i_node::~__i_node()
{
if (__next_)
{
__next_->~__i_node();
free(__next_);
}
}
__c_node::~__c_node()
{
free(beg_);
if (__next_)
{
__next_->~__c_node();
free(__next_);
}
}
__libcpp_db::__libcpp_db()
: __cbeg_(nullptr),
__cend_(nullptr),
__csz_(0),
__ibeg_(nullptr),
__iend_(nullptr),
__isz_(0)
{
}
__libcpp_db::~__libcpp_db()
{
if (__cbeg_)
{
for (__c_node** p = __cbeg_; p != __cend_; ++p)
{
if (*p != nullptr)
{
(*p)->~__c_node();
free(*p);
}
}
free(__cbeg_);
}
if (__ibeg_)
{
for (__i_node** p = __ibeg_; p != __iend_; ++p)
{
if (*p != nullptr)
{
(*p)->~__i_node();
free(*p);
}
}
free(__ibeg_);
}
}
void*
__libcpp_db::__find_c_from_i(void* __i) const
{
RLock _(mut());
__i_node* i = __find_iterator(__i);
_LIBCPP_ASSERT(i != nullptr, "iterator constructed in translation unit with debug mode not enabled."
" #define _LIBCPP_DEBUG2 1 for that translation unit.");
return i->__c_ != nullptr ? i->__c_->__c_ : nullptr;
}
void
__libcpp_db::__insert_ic(void* __i, const void* __c)
{
WLock _(mut());
__i_node* i = __insert_iterator(__i);
const char* errmsg =
"Container constructed in a translation unit with debug mode disabled."
" But it is being used in a translation unit with debug mode enabled."
" Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1";
_LIBCPP_ASSERT(__cbeg_ != __cend_, errmsg);
size_t hc = hash<const void*>()(__c) % (__cend_ - __cbeg_);
__c_node* c = __cbeg_[hc];
_LIBCPP_ASSERT(c != nullptr, errmsg);
while (c->__c_ != __c)
{
c = c->__next_;
_LIBCPP_ASSERT(c != nullptr, errmsg);
}
c->__add(i);
i->__c_ = c;
}
__c_node*
__libcpp_db::__insert_c(void* __c)
{
WLock _(mut());
if (__csz_ + 1 > __cend_ - __cbeg_)
{
size_t nc = __next_prime(2*(__cend_ - __cbeg_) + 1);
__c_node** cbeg = (__c_node**)calloc(nc, sizeof(void*));
if (cbeg == nullptr)
throw bad_alloc();
for (__c_node** p = __cbeg_; p != __cend_; ++p)
{
__c_node* q = *p;
while (q != nullptr)
{
size_t h = hash<void*>()(q->__c_) % nc;
__c_node* r = q->__next_;
q->__next_ = cbeg[h];
cbeg[h] = q;
q = r;
}
}
free(__cbeg_);
__cbeg_ = cbeg;
__cend_ = __cbeg_ + nc;
}
size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
__c_node* r = __cbeg_[hc] = (__c_node*)malloc(sizeof(__c_node));
if (__cbeg_[hc] == nullptr)
throw bad_alloc();
r->__c_ = __c;
r->__next_ = p;
++__csz_;
return r;
}
void
__libcpp_db::__erase_i(void* __i)
{
WLock _(mut());
if (__ibeg_ != __iend_)
{
size_t hi = hash<void*>()(__i) % (__iend_ - __ibeg_);
__i_node* p = __ibeg_[hi];
if (p != nullptr)
{
__i_node* q = nullptr;
while (p->__i_ != __i)
{
q = p;
p = p->__next_;
if (p == nullptr)
return;
}
if (q == nullptr)
__ibeg_[hi] = p->__next_;
else
q->__next_ = p->__next_;
__c_node* c = p->__c_;
free(p);
--__isz_;
if (c != nullptr)
c->__remove(p);
}
}
}
void
__libcpp_db::__invalidate_all(void* __c)
{
WLock _(mut());
size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __invalidate_all A");
while (p->__c_ != __c)
{
p = p->__next_;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __invalidate_all B");
}
while (p->end_ != p->beg_)
{
--p->end_;
(*p->end_)->__c_ = nullptr;
}
}
__c_node*
__libcpp_db::__find_c_and_lock(void* __c) const
{
mut().lock();
size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c_and_lock A");
while (p->__c_ != __c)
{
p = p->__next_;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c_and_lock B");
}
return p;
}
__c_node*
__libcpp_db::__find_c(void* __c) const
{
size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c A");
while (p->__c_ != __c)
{
p = p->__next_;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c B");
}
return p;
}
void
__libcpp_db::unlock() const
{
mut().unlock();
}
void
__libcpp_db::__erase_c(void* __c)
{
WLock _(mut());
size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
__c_node* q = nullptr;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c A");
while (p->__c_ != __c)
{
q = p;
p = p->__next_;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c B");
}
if (q == nullptr)
__cbeg_[hc] = p->__next_;
else
q->__next_ = p->__next_;
while (p->end_ != p->beg_)
{
--p->end_;
(*p->end_)->__c_ = nullptr;
}
free(p->beg_);
free(p);
--__csz_;
}
void
__libcpp_db::__iterator_copy(void* __i, const void* __i0)
{
WLock _(mut());
__i_node* i = __find_iterator(__i);
__i_node* i0 = __find_iterator(__i0);
__c_node* c0 = i0 != nullptr ? i0->__c_ : nullptr;
if (i == nullptr && c0 != nullptr)
i = __insert_iterator(__i);
__c_node* c = i != nullptr ? i->__c_ : nullptr;
if (c != c0)
{
if (c != nullptr)
c->__remove(i);
if (i != nullptr)
{
i->__c_ = nullptr;
if (c0 != nullptr)
{
i->__c_ = c0;
i->__c_->__add(i);
}
}
}
}
bool
__libcpp_db::__dereferenceable(const void* __i) const
{
RLock _(mut());
__i_node* i = __find_iterator(__i);
return i != nullptr && i->__c_ != nullptr && i->__c_->__dereferenceable(__i);
}
bool
__libcpp_db::__decrementable(const void* __i) const
{
RLock _(mut());
__i_node* i = __find_iterator(__i);
return i != nullptr && i->__c_ != nullptr && i->__c_->__decrementable(__i);
}
bool
__libcpp_db::__addable(const void* __i, ptrdiff_t __n) const
{
RLock _(mut());
__i_node* i = __find_iterator(__i);
return i != nullptr && i->__c_ != nullptr && i->__c_->__addable(__i, __n);
}
bool
__libcpp_db::__subscriptable(const void* __i, ptrdiff_t __n) const
{
RLock _(mut());
__i_node* i = __find_iterator(__i);
return i != nullptr && i->__c_ != nullptr && i->__c_->__subscriptable(__i, __n);
}
bool
__libcpp_db::__comparable(const void* __i, const void* __j) const
{
RLock _(mut());
__i_node* i = __find_iterator(__i);
__i_node* j = __find_iterator(__j);
__c_node* ci = i != nullptr ? i->__c_ : nullptr;
__c_node* cj = j != nullptr ? j->__c_ : nullptr;
return ci != nullptr && ci == cj;
}
void
__libcpp_db::swap(void* c1, void* c2)
{
WLock _(mut());
size_t hc = hash<void*>()(c1) % (__cend_ - __cbeg_);
__c_node* p1 = __cbeg_[hc];
_LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap A");
while (p1->__c_ != c1)
{
p1 = p1->__next_;
_LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap B");
}
hc = hash<void*>()(c2) % (__cend_ - __cbeg_);
__c_node* p2 = __cbeg_[hc];
_LIBCPP_ASSERT(p2 != nullptr, "debug mode internal logic error swap C");
while (p2->__c_ != c2)
{
p2 = p2->__next_;
_LIBCPP_ASSERT(p2 != nullptr, "debug mode internal logic error swap D");
}
std::swap(p1->beg_, p2->beg_);
std::swap(p1->end_, p2->end_);
std::swap(p1->cap_, p2->cap_);
for (__i_node** p = p1->beg_; p != p1->end_; ++p)
(*p)->__c_ = p1;
for (__i_node** p = p2->beg_; p != p2->end_; ++p)
(*p)->__c_ = p2;
}
void
__libcpp_db::__insert_i(void* __i)
{
WLock _(mut());
__insert_iterator(__i);
}
void
__c_node::__add(__i_node* i)
{
if (end_ == cap_)
{
size_t nc = 2*(cap_ - beg_);
if (nc == 0)
nc = 1;
__i_node** beg = (__i_node**)malloc(nc * sizeof(__i_node*));
if (beg == nullptr)
throw bad_alloc();
if (nc > 1)
memcpy(beg, beg_, nc/2*sizeof(__i_node*));
free(beg_);
beg_ = beg;
end_ = beg_ + nc/2;
cap_ = beg_ + nc;
}
*end_++ = i;
}
// private api
_LIBCPP_HIDDEN
__i_node*
__libcpp_db::__insert_iterator(void* __i)
{
if (__isz_ + 1 > __iend_ - __ibeg_)
{
size_t nc = __next_prime(2*(__iend_ - __ibeg_) + 1);
__i_node** ibeg = (__i_node**)calloc(nc, sizeof(void*));
if (ibeg == nullptr)
throw bad_alloc();
for (__i_node** p = __ibeg_; p != __iend_; ++p)
{
__i_node* q = *p;
while (q != nullptr)
{
size_t h = hash<void*>()(q->__i_) % nc;
__i_node* r = q->__next_;
q->__next_ = ibeg[h];
ibeg[h] = q;
q = r;
}
}
free(__ibeg_);
__ibeg_ = ibeg;
__iend_ = __ibeg_ + nc;
}
size_t hi = hash<void*>()(__i) % (__iend_ - __ibeg_);
__i_node* p = __ibeg_[hi];
__i_node* r = __ibeg_[hi] = (__i_node*)malloc(sizeof(__i_node));
if (r == nullptr)
throw bad_alloc();
::new(r) __i_node(__i, p, nullptr);
++__isz_;
return r;
}
_LIBCPP_HIDDEN
__i_node*
__libcpp_db::__find_iterator(const void* __i) const
{
__i_node* r = nullptr;
if (__ibeg_ != __iend_)
{
size_t h = hash<const void*>()(__i) % (__iend_ - __ibeg_);
for (__i_node* nd = __ibeg_[h]; nd != nullptr; nd = nd->__next_)
{
if (nd->__i_ == __i)
{
r = nd;
break;
}
}
}
return r;
}
_LIBCPP_HIDDEN
void
__c_node::__remove(__i_node* p)
{
__i_node** r = find(beg_, end_, p);
_LIBCPP_ASSERT(r != end_, "debug mode internal logic error __c_node::__remove");
if (--end_ != r)
memmove(r, r+1, (end_ - r)*sizeof(__i_node*));
}
_LIBCPP_END_NAMESPACE_STD

View File

@@ -13,24 +13,16 @@
#if __APPLE__
#include <cxxabi.h>
using namespace __cxxabiv1;
using namespace __cxxabiapple;
// On Darwin, there are two STL shared libraries and a lower level ABI
// shared libray. The globals holding the current terminate handler and
// current unexpected handler are in the ABI library.
#define __terminate_handler __cxxabiapple::__cxa_terminate_handler
#define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
#define HAVE_DEPENDENT_EH_ABI 1
#elif defined(LIBCXXRT)
#include <cxxabi.h>
using namespace __cxxabiv1;
#define HAVE_DEPENDENT_EH_ABI 1
#else // __APPLE__
static std::terminate_handler __terminate_handler;
static std::unexpected_handler __unexpected_handler;
#endif // __APPLE__
#ifndef LIBCXXRT
// libcxxrt provides implementations of these functions itself.
std::unexpected_handler
std::set_unexpected(std::unexpected_handler func) _NOEXCEPT
{
@@ -64,7 +56,6 @@ std::get_terminate() _NOEXCEPT
return __sync_fetch_and_add(&__terminate_handler, (std::terminate_handler)0);
}
_ATTRIBUTE(noreturn)
void
std::terminate() _NOEXCEPT
{
@@ -84,19 +75,18 @@ std::terminate() _NOEXCEPT
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
#endif // LIBCXXRT
bool std::uncaught_exception() _NOEXCEPT
{
#if __APPLE__
// on Darwin, there is a helper function so __cxa_get_globals is private
return __cxxabiapple::__cxa_uncaught_exception();
#elif LIBCXXRT
__cxa_eh_globals * globals = __cxa_get_globals();
return (globals->uncaughtExceptions != 0);
#else // __APPLE__
#warning uncaught_exception not yet implemented
::abort();
// Not provided by Ubuntu gcc-4.2.4's cxxabi.h.
// __cxa_eh_globals * globals = __cxa_get_globals();
// return (globals->uncaughtExceptions != 0);
#endif // __APPLE__
}
@@ -123,8 +113,8 @@ const char* bad_exception::what() const _NOEXCEPT
exception_ptr::~exception_ptr() _NOEXCEPT
{
#if HAVE_DEPENDENT_EH_ABI
__cxa_decrement_exception_refcount(__ptr_);
#if __APPLE__
__cxxabiapple::__cxa_decrement_exception_refcount(__ptr_);
#else
#warning exception_ptr not yet implemented
::abort();
@@ -134,8 +124,8 @@ exception_ptr::~exception_ptr() _NOEXCEPT
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
: __ptr_(other.__ptr_)
{
#if HAVE_DEPENDENT_EH_ABI
__cxa_increment_exception_refcount(__ptr_);
#if __APPLE__
__cxxabiapple::__cxa_increment_exception_refcount(__ptr_);
#else
#warning exception_ptr not yet implemented
::abort();
@@ -144,11 +134,11 @@ exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
{
#if HAVE_DEPENDENT_EH_ABI
#if __APPLE__
if (__ptr_ != other.__ptr_)
{
__cxa_increment_exception_refcount(other.__ptr_);
__cxa_decrement_exception_refcount(__ptr_);
__cxxabiapple::__cxa_increment_exception_refcount(other.__ptr_);
__cxxabiapple::__cxa_decrement_exception_refcount(__ptr_);
__ptr_ = other.__ptr_;
}
return *this;
@@ -180,12 +170,12 @@ nested_exception::rethrow_nested() const
std::exception_ptr std::current_exception() _NOEXCEPT
{
#if HAVE_DEPENDENT_EH_ABI
#if __APPLE__
// be nicer if there was a constructor that took a ptr, then
// this whole function would be just:
// return exception_ptr(__cxa_current_primary_exception());
std::exception_ptr ptr;
ptr.__ptr_ = __cxa_current_primary_exception();
ptr.__ptr_ = __cxxabiapple::__cxa_current_primary_exception();
return ptr;
#else // __APPLE__
#warning exception_ptr not yet implemented
@@ -195,8 +185,8 @@ std::exception_ptr std::current_exception() _NOEXCEPT
void std::rethrow_exception(exception_ptr p)
{
#if HAVE_DEPENDENT_EH_ABI
__cxa_rethrow_primary_exception(p.__ptr_);
#if __APPLE__
__cxxabiapple::__cxa_rethrow_primary_exception(p.__ptr_);
// if p.__ptr_ is NULL, above returns so we terminate
terminate();
#else // __APPLE__

View File

@@ -19,24 +19,116 @@
#include "cstring"
#include "cwctype"
#include "__sso_allocator"
#if _WIN32
#include <support/win32/locale_win32.h>
#else // _WIN32
#include <langinfo.h>
#endif // _!WIN32
#include <stdlib.h>
namespace {
typedef std::remove_pointer<locale_t>::type locale_struct;
typedef std::unique_ptr<locale_struct, decltype(&freelocale)> locale_unique_ptr;
typedef std::unique_ptr<locale_struct, decltype(&uselocale)> locale_raii;
}
namespace with_locale { namespace {
#ifdef __APPLE__
using ::btowc_l;
using ::wctob_l;
using ::wcsnrtombs_l;
using ::wcrtomb_l;
using ::mbsnrtowcs_l;
using ::mbrtowc_l;
using ::mbtowc_l;
using ::mbrlen_l;
using ::localeconv_l;
using ::mbsrtowcs_l;
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
inline _LIBCPP_INLINE_VISIBILITY
mb_cur_max_l(locale_t loc)
{
return MB_CUR_MAX_L(loc);
}
#else
template
<typename Function, typename ...Args>
auto using_locale(Function f, locale_t loc, Args&&... params) -> decltype(f(std::forward<Args>(params)...))
{
locale_raii current(uselocale(loc), uselocale);
return f(std::forward<Args>(params)...);
}
decltype(MB_CUR_MAX)
mb_cur_max_l(locale_t loc)
{
locale_raii current(uselocale(loc), uselocale);
return MB_CUR_MAX;
}
wint_t btowc_l(int c, locale_t l) { return using_locale(&btowc, l, c); }
int wctob_l(wint_t c, locale_t l) { return using_locale(&wctob, l, c); }
size_t wcsnrtombs_l(char * dest,
const wchar_t * * src,
size_t nwc,
size_t len,
mbstate_t * ps,
locale_t l)
{
return using_locale(&wcsnrtombs, l, dest, src, nwc, len, ps);
}
size_t wcrtomb_l(char *s, wchar_t wc, mbstate_t *ps, locale_t l)
{
return using_locale(&wcrtomb, l, s, wc, ps);
}
size_t mbsnrtowcs_l(wchar_t * dest,
const char * * src,
size_t nms,
size_t len,
mbstate_t * ps,
locale_t l)
{
return using_locale(&mbsnrtowcs, l, dest, src, nms, len, ps);
}
size_t mbrtowc_l(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps, locale_t l)
{
return using_locale(&mbrtowc, l, pwc, s, n, ps);
}
int mbtowc_l(wchar_t * pwc, const char * pmb, size_t max, locale_t l)
{
return using_locale(&mbtowc, l, pwc, pmb, max);
}
size_t mbrlen_l(const char *s, size_t n, mbstate_t *ps, locale_t l)
{
return using_locale(&mbrlen, l, s, n, ps);
}
struct lconv *localeconv_l(locale_t l)
{
return using_locale(&localeconv, l);
}
size_t mbsrtowcs_l(wchar_t * dest,
const char * * src,
size_t len,
mbstate_t * ps,
locale_t l)
{
return using_locale(&mbsrtowcs, l, dest, src, len, ps);
}
#endif
} }
_LIBCPP_BEGIN_NAMESPACE_STD
#ifdef __cloc_defined
#ifndef _LIBCPP_APPLE_STABLE_ABI
locale_t __cloc() {
// In theory this could create a race condition. In practice
// the race condition is non-fatal since it will just create
// a little resource leak. Better approach would be appreciated.
#ifdef __APPLE__
return 0;
#else
static locale_t result = newlocale(LC_ALL_MASK, "C", 0);
return result;
#endif
}
#endif // __cloc_defined
#endif // _LIBCPP_APPLE_STABLE_ABI
namespace {
@@ -722,12 +814,10 @@ ctype<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high)
wchar_t
ctype<wchar_t>::do_toupper(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
#elif defined(__GLIBC__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
#else
return (isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c;
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
#endif
}
@@ -735,13 +825,11 @@ const wchar_t*
ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
#elif defined(__GLIBC__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
: *low;
#else
*low = (isascii(*low) && islower_l(*low, __cloc())) ? (*low-L'a'+L'A') : *low;
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
#endif
return low;
}
@@ -749,12 +837,10 @@ ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
wchar_t
ctype<wchar_t>::do_tolower(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
#elif defined(__GLIBC__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
#else
return (isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c;
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
#endif
}
@@ -762,13 +848,11 @@ const wchar_t*
ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
#elif defined(__GLIBC__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
: *low;
#else
*low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-L'A'+L'a' : *low;
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
#endif
return low;
}
@@ -828,12 +912,10 @@ ctype<char>::~ctype()
char
ctype<char>::do_toupper(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
#elif defined(__GLIBC__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
return isascii(c) ? __classic_upper_table()[c] : c;
#else
return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c;
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
#endif
}
@@ -841,12 +923,10 @@ const char*
ctype<char>::do_toupper(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
#elif defined(__GLIBC__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
*low = isascii(*low) ? __classic_upper_table()[*low] : *low;
#else
*low = (isascii(*low) && islower_l(*low, __cloc())) ? *low-'a'+'A' : *low;
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
#endif
return low;
}
@@ -854,12 +934,10 @@ ctype<char>::do_toupper(char_type* low, const char_type* high) const
char
ctype<char>::do_tolower(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
#elif defined(__GLIBC__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
return isascii(c) ? __classic_lower_table()[c] : c;
#else
return (isascii(c) && isupper_l(c, __cloc())) ? c-'A'+'a' : c;
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
#endif
}
@@ -867,12 +945,10 @@ const char*
ctype<char>::do_tolower(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
#elif defined(__GLIBC__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
*low = isascii(*low) ? __classic_lower_table()[*low] : *low;
#else
*low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low;
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
#endif
return low;
}
@@ -913,32 +989,41 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
const ctype<char>::mask*
ctype<char>::classic_table() _NOEXCEPT
{
#if defined(__APPLE__) || defined(__FreeBSD__)
#ifdef __APPLE__
return _DefaultRuneLocale.__runetype;
#elif defined(__GLIBC__)
return __cloc()->__ctype_b;
#elif _WIN32
return _ctype+1; // internal ctype mask table defined in msvcrt.dll
// This is assumed to be safe, which is a nonsense assumption because we're
// going to end up dereferencing it later...
// This is assumed to be safe.
#else
return NULL;
#endif
}
#if defined(__GLIBC__)
#ifndef _LIBCPP_STABLE_APPLE_ABI
const int*
ctype<char>::__classic_lower_table() _NOEXCEPT
{
#ifdef __APPLE__
return _DefaultRuneLocale.__maplower;
#elif defined(__GLIBC__)
return __cloc()->__ctype_tolower;
#else
return NULL;
#endif
}
const int*
ctype<char>::__classic_upper_table() _NOEXCEPT
{
#ifdef __APPLE__
return _DefaultRuneLocale.__mapupper;
#elif defined(__GLIBC__)
return __cloc()->__ctype_toupper;
#else
return NULL;
#endif
}
#endif // __GLIBC__
#endif // _LIBCPP_APPLE_STABLE_ABI
// template <> class ctype_byname<char>
@@ -1032,18 +1117,17 @@ ctype_byname<wchar_t>::do_is(mask m, char_type c) const
#ifdef _LIBCPP_WCTYPE_IS_MASK
return static_cast<bool>(iswctype_l(c, m, __l));
#else
bool result = true;
if (m & space && !iswspace_l(c, __l)) result = false;
if (m & print && !iswprint_l(c, __l)) result = false;
if (m & cntrl && !iswcntrl_l(c, __l)) result = false;
if (m & upper && !iswupper_l(c, __l)) result = false;
if (m & lower && !iswlower_l(c, __l)) result = false;
if (m & alpha && !iswalpha_l(c, __l)) result = false;
if (m & digit && !iswdigit_l(c, __l)) result = false;
if (m & punct && !iswpunct_l(c, __l)) result = false;
if (m & xdigit && !iswxdigit_l(c, __l)) result = false;
if (m & blank && !iswblank_l(c, __l)) result = false;
return result;
if (m & space && !iswspace_l(c, __l)) return false;
if (m & print && !iswprint_l(c, __l)) return false;
if (m & cntrl && !iswcntrl_l(c, __l)) return false;
if (m & upper && !iswupper_l(c, __l)) return false;
if (m & lower && !iswlower_l(c, __l)) return false;
if (m & alpha && !iswalpha_l(c, __l)) return false;
if (m & digit && !iswdigit_l(c, __l)) return false;
if (m & punct && !iswpunct_l(c, __l)) return false;
if (m & xdigit && !iswxdigit_l(c, __l)) return false;
if (m & blank && !iswblank_l(c, __l)) return false;
return true;
#endif
}
@@ -1161,33 +1245,21 @@ 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 _LIBCPP_LOCALE__L_EXTENSIONS
return btowc_l(c, __l);
#else
return __btowc_l(c, __l);
#endif
return with_locale::btowc_l(c, __l);
}
const char*
ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const
{
for (; low != high; ++low, ++dest)
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
*dest = btowc_l(*low, __l);
#else
*dest = __btowc_l(*low, __l);
#endif
*dest = with_locale::btowc_l(*low, __l);
return low;
}
char
ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int r = wctob_l(c, __l);
#else
int r = __wctob_l(c, __l);
#endif
int r = with_locale::wctob_l(c, __l);
return r != WEOF ? static_cast<char>(r) : dfault;
}
@@ -1196,11 +1268,7 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch
{
for (; low != high; ++low, ++dest)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int r = wctob_l(*low, __l);
#else
int r = __wctob_l(*low, __l);
#endif
int r = with_locale::wctob_l(*low, __l);
*dest = r != WEOF ? static_cast<char>(r) : dfault;
}
return low;
@@ -1310,21 +1378,13 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
{
// save state in case needed to reover to_nxt on error
mbstate_t save_state = st;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t n = wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
#else
size_t n = __wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
#endif
size_t n = with_locale::wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
if (n == size_t(-1))
{
// need to recover to_nxt
for (to_nxt = to; frm != frm_nxt; ++frm)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
n = wcrtomb_l(to_nxt, *frm, &save_state, __l);
#else
n = __wcrtomb_l(to_nxt, *frm, &save_state, __l);
#endif
n = with_locale::wcrtomb_l(to_nxt, *frm, &save_state, __l);
if (n == size_t(-1))
break;
to_nxt += n;
@@ -1341,11 +1401,7 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
{
// Try to write the terminating null
extern_type tmp[MB_LEN_MAX];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
n = wcrtomb_l(tmp, intern_type(), &st, __l);
#else
n = __wcrtomb_l(tmp, intern_type(), &st, __l);
#endif
n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l);
if (n == size_t(-1)) // on error
return error;
if (n > to_end-to_nxt) // is there room?
@@ -1378,21 +1434,13 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
{
// save state in case needed to reover to_nxt on error
mbstate_t save_state = st;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t n = mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
#else
size_t n = __mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
#endif
size_t n = with_locale::mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
if (n == size_t(-1))
{
// need to recover to_nxt
for (to_nxt = to; frm != frm_nxt; ++to_nxt)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
n = mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
#else
n = __mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
#endif
n = with_locale::mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
switch (n)
{
case 0:
@@ -1420,11 +1468,7 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
if (fend != frm_end) // set up next null terminated sequence
{
// Try to write the terminating null
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
n = mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
#else
n = __mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
#endif
n = with_locale::mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
if (n != 0) // on error
return error;
++to_nxt;
@@ -1444,11 +1488,7 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
{
to_nxt = to;
extern_type tmp[MB_LEN_MAX];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t n = wcrtomb_l(tmp, intern_type(), &st, __l);
#else
size_t n = __wcrtomb_l(tmp, intern_type(), &st, __l);
#endif
size_t n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l);
if (n == size_t(-1) || n == 0) // on error
return error;
--n;
@@ -1462,18 +1502,10 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
int
codecvt<wchar_t, char, mbstate_t>::do_encoding() const _NOEXCEPT
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
if (mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
#else
if (__mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
#endif
if (with_locale::mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
{
// stateless encoding
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
if (__l == 0 || MB_CUR_MAX_L(__l) == 1) // there are no known constant length encodings
#else
if (__l == 0 || __mb_cur_max_l(__l) == 1) // there are no known constant length encodings
#endif
if (__l == 0 || with_locale::mb_cur_max_l(__l) == 1) // there are no known constant length encodings
return 1; // which take more than 1 char to form a wchar_t
return 0;
}
@@ -1493,11 +1525,7 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
int nbytes = 0;
for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t n = mbrlen_l(frm, frm_end-frm, &st, __l);
#else
size_t n = __mbrlen_l(frm, frm_end-frm, &st, __l);
#endif
size_t n = with_locale::mbrlen_l(frm, frm_end-frm, &st, __l);
switch (n)
{
case 0:
@@ -1519,11 +1547,7 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
int
codecvt<wchar_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return __l == 0 ? 1 : MB_CUR_MAX_L(__l);
#else
return __l == 0 ? 1 : __mb_cur_max_l(__l);
#endif
return __l == 0 ? 1 : with_locale::mb_cur_max_l(__l);
}
// Valid UTF ranges
@@ -4066,17 +4090,13 @@ numpunct_byname<char>::__init(const char* nm)
{
if (strcmp(nm, "C") != 0)
{
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (loc == 0)
throw runtime_error("numpunct_byname<char>::numpunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->decimal_point)
__decimal_point_ = *lc->decimal_point;
if (*lc->thousands_sep)
@@ -4109,17 +4129,13 @@ numpunct_byname<wchar_t>::__init(const char* nm)
{
if (strcmp(nm, "C") != 0)
{
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (loc == 0)
throw runtime_error("numpunct_byname<char>::numpunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->decimal_point)
__decimal_point_ = *lc->decimal_point;
if (*lc->thousands_sep)
@@ -4710,11 +4726,7 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
wchar_t* wbb = wbuf;
mbstate_t mb = {0};
const char* bb = buf;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t i = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#else
size_t i = __mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
size_t i = with_locale::mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
if (i == -1)
__throw_runtime_error("locale not supported");
wchar_t* wbe = wbb + i;
@@ -4895,11 +4907,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%A", &t, __loc_);
mb = mbstate_t();
const char* bb = buf;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -4907,11 +4915,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%a", &t, __loc_);
mb = mbstate_t();
bb = buf;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -4924,11 +4928,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%B", &t, __loc_);
mb = mbstate_t();
const char* bb = buf;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -4936,11 +4936,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%b", &t, __loc_);
mb = mbstate_t();
bb = buf;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -4951,11 +4947,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%p", &t, __loc_);
mb = mbstate_t();
const char* bb = buf;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -4964,11 +4956,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%p", &t, __loc_);
mb = mbstate_t();
bb = buf;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -5243,11 +5231,7 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
__do_put(__nar, __ne, __tm, __fmt, __mod);
mbstate_t mb = {0};
const char* __nb = __nar;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
#else
size_t j = __mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
#endif
size_t j = with_locale::mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
if (j == -1)
__throw_runtime_error("locale not supported");
__we = __wb + j;
@@ -5496,17 +5480,13 @@ void
moneypunct_byname<char, false>::init(const char* nm)
{
typedef moneypunct<char, false> base;
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (loc == 0)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = *lc->mon_decimal_point;
else
@@ -5538,17 +5518,13 @@ void
moneypunct_byname<char, true>::init(const char* nm)
{
typedef moneypunct<char, true> base;
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (loc == 0)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = *lc->mon_decimal_point;
else
@@ -5563,29 +5539,16 @@ moneypunct_byname<char, true>::init(const char* nm)
__frac_digits_ = lc->int_frac_digits;
else
__frac_digits_ = base::do_frac_digits();
#if _WIN32
if (lc->p_sign_posn == 0)
#else // _WIN32
if (lc->int_p_sign_posn == 0)
#endif //_WIN32
__positive_sign_ = "()";
else
__positive_sign_ = lc->positive_sign;
#if _WIN32
if(lc->n_sign_posn == 0)
#else // _WIN32
if (lc->int_n_sign_posn == 0)
#endif // _WIN32
__negative_sign_ = "()";
else
__negative_sign_ = lc->negative_sign;
#if _WIN32
__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);
#else
__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 // _WIN32
}
template<>
@@ -5593,17 +5556,13 @@ void
moneypunct_byname<wchar_t, false>::init(const char* nm)
{
typedef moneypunct<wchar_t, false> base;
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (loc == 0)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
else
@@ -5616,11 +5575,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
wchar_t wbuf[100];
mbstate_t mb = {0};
const char* bb = lc->currency_symbol;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
if (j == -1)
__throw_runtime_error("locale not supported");
wchar_t* wbe = wbuf + j;
@@ -5635,11 +5590,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
{
mb = mbstate_t();
bb = lc->positive_sign;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -5651,11 +5602,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
{
mb = mbstate_t();
bb = lc->negative_sign;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -5670,17 +5617,13 @@ void
moneypunct_byname<wchar_t, true>::init(const char* nm)
{
typedef moneypunct<wchar_t, true> base;
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (loc == 0)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
else
@@ -5693,11 +5636,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
wchar_t wbuf[100];
mbstate_t mb = {0};
const char* bb = lc->int_curr_symbol;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
if (j == -1)
__throw_runtime_error("locale not supported");
wchar_t* wbe = wbuf + j;
@@ -5706,53 +5645,32 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
__frac_digits_ = lc->int_frac_digits;
else
__frac_digits_ = base::do_frac_digits();
#if _WIN32
if (lc->p_sign_posn == 0)
#else // _WIN32
if (lc->int_p_sign_posn == 0)
#endif // _WIN32
__positive_sign_ = L"()";
else
{
mb = mbstate_t();
bb = lc->positive_sign;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__positive_sign_.assign(wbuf, wbe);
}
#if _WIN32
if (lc->n_sign_posn == 0)
#else // _WIN32
if (lc->int_n_sign_posn == 0)
#endif // _WIN32
__negative_sign_ = L"()";
else
{
mb = mbstate_t();
bb = lc->negative_sign;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__negative_sign_.assign(wbuf, wbe);
}
#if _WIN32
__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);
#else // _WIN32
__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 // _WIN32
}
void __do_nothing(void*) {}

View File

@@ -11,9 +11,6 @@
#include "cstdlib"
#include "cwchar"
#include "cerrno"
#if _WIN32
#include "support/win32/support.h"
#endif // _WIN32
_LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -1,94 +0,0 @@
// -*- C++ -*-
//===-------------------- support/win32/locale_win32.cpp ------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "support/win32/locale_win32.h"
#include <stdarg.h> // va_start, va_end
// FIXME: base currently unused. Needs manual work to construct the new locale
locale_t newlocale( int mask, const char * locale, locale_t /*base*/ )
{
return _create_locale( mask, locale );
}
locale_t uselocale( locale_t newloc )
{
locale_t old_locale = _get_current_locale();
// uselocale sets the thread's locale by definition, so unconditionally use thread-local locale
_configthreadlocale( _ENABLE_PER_THREAD_LOCALE );
// uselocale sets all categories
setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale );
// uselocale returns the old locale_t
return old_locale;
}
lconv *localeconv_l( locale_t loc )
{
__locale_raii __current( uselocale(loc), uselocale );
return localeconv();
}
size_t mbrlen_l( const char *__restrict__ s, size_t n,
mbstate_t *__restrict__ ps, locale_t loc )
{
__locale_raii __current( uselocale(loc), uselocale );
return mbrlen( s, n, ps );
}
size_t mbsrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t len, mbstate_t *__restrict__ ps, locale_t loc )
{
__locale_raii __current( uselocale(loc), uselocale );
return mbsrtowcs( dst, src, len, ps );
}
size_t wcrtomb_l( char *__restrict__ s, wchar_t wc, mbstate_t *__restrict__ ps,
locale_t loc )
{
__locale_raii __current( uselocale(loc), uselocale );
return wcrtomb( s, wc, ps );
}
size_t mbrtowc_l( wchar_t *__restrict__ pwc, const char *__restrict__ s,
size_t n, mbstate_t *__restrict__ ps, locale_t loc )
{
__locale_raii __current( uselocale(loc), uselocale );
return mbrtowc( pwc, s, n, ps );
}
size_t mbsnrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t nms, size_t len, mbstate_t *__restrict__ ps, locale_t loc )
{
__locale_raii __current( uselocale(loc), uselocale );
return mbsnrtowcs( dst, src, nms, len, ps );
}
size_t wcsnrtombs_l( char *__restrict__ dst, const wchar_t **__restrict__ src,
size_t nwc, size_t len, mbstate_t *__restrict__ ps, locale_t loc )
{
__locale_raii __current( uselocale(loc), uselocale );
return wcsnrtombs( dst, src, nwc, len, ps );
}
wint_t btowc_l( int c, locale_t loc )
{
__locale_raii __current( uselocale(loc), uselocale );
return btowc( c );
}
int wctob_l( wint_t c, locale_t loc )
{
__locale_raii __current( uselocale(loc), uselocale );
return wctob( c );
}
int asprintf_l( char **ret, locale_t loc, const char *format, ... )
{
va_list ap;
va_start( ap, format );
int result = vasprintf_l( ret, loc, format, ap );
va_end(ap);
return result;
}
int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap )
{
__locale_raii __current( uselocale(loc), uselocale );
return vasprintf( ret, format, ap );
}

View File

@@ -1,70 +0,0 @@
// -*- C++ -*-
//===----------------------- support/win32/support.h ----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <support/win32/support.h>
#include <stdarg.h> // va_start, va_end
#include <stddef.h> // size_t
#include <stdlib.h> // malloc
#include <stdio.h> // vsprintf, vsnprintf
#include <string.h> // strcpy, wcsncpy
int asprintf(char **sptr, const char *__restrict__ fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int result = vasprintf(sptr, fmt, ap);
va_end(ap);
return result;
}
int vasprintf( char **sptr, const char *__restrict__ fmt, va_list ap )
{
*sptr = NULL;
int count = vsnprintf( *sptr, 0, fmt, ap );
if( (count >= 0) && ((*sptr = (char*)malloc(count+1)) != NULL) )
{
vsprintf( *sptr, fmt, ap );
sptr[count] = '\0';
}
return count;
}
// FIXME: use wcrtomb and avoid copy
// use mbsrtowcs which is available, first copy first nwc elements of src
size_t mbsnrtowcs( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t nmc, size_t len, mbstate_t *__restrict__ ps )
{
char* local_src = new char[nmc+1];
char* nmcsrc = local_src;
strncpy( nmcsrc, *src, nmc );
nmcsrc[nmc] = '\0';
const size_t result = mbsrtowcs( dst, const_cast<const char **>(&nmcsrc), len, ps );
// propagate error
if( nmcsrc == NULL )
*src = NULL;
delete[] local_src;
return result;
}
// FIXME: use wcrtomb and avoid copy
// use wcsrtombs which is available, first copy first nwc elements of src
size_t wcsnrtombs( char *__restrict__ dst, const wchar_t **__restrict__ src,
size_t nwc, size_t len, mbstate_t *__restrict__ ps )
{
wchar_t* local_src = new wchar_t[nwc];
wchar_t* nwcsrc = local_src;
wcsncpy(nwcsrc, *src, nwc);
nwcsrc[nwc] = '\0';
const size_t result = wcsrtombs( dst, const_cast<const wchar_t **>(&nwcsrc), len, ps );
// propogate error
if( nwcsrc == NULL )
*src = NULL;
delete[] nwcsrc;
return result;
}

View File

@@ -12,9 +12,7 @@
#include "vector"
#include "future"
#include <sys/types.h>
#if !_WIN32
#include <sys/sysctl.h>
#endif // _WIN32
_LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
int i = std::max({2, 3, 1});
assert(i == 3);
i = std::max({2, 1, 3});
@@ -31,5 +31,5 @@ int main()
assert(i == 3);
i = std::max({1, 3, 2});
assert(i == 3);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -19,7 +19,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
int i = std::max({2, 3, 1}, std::greater<int>());
assert(i == 1);
i = std::max({2, 1, 3}, std::greater<int>());
@@ -32,5 +32,5 @@ int main()
assert(i == 1);
i = std::max({1, 3, 2}, std::greater<int>());
assert(i == 1);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
int i = std::min({2, 3, 1});
assert(i == 1);
i = std::min({2, 1, 3});
@@ -31,5 +31,5 @@ int main()
assert(i == 1);
i = std::min({1, 3, 2});
assert(i == 1);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -19,7 +19,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
int i = std::min({2, 3, 1}, std::greater<int>());
assert(i == 3);
i = std::min({2, 1, 3}, std::greater<int>());
@@ -32,5 +32,5 @@ int main()
assert(i == 3);
i = std::min({1, 3, 2}, std::greater<int>());
assert(i == 3);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,12 +18,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)));
assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)));
assert((std::minmax({2, 1, 3}) == std::pair<int, int>(1, 3)));
assert((std::minmax({2, 3, 1}) == std::pair<int, int>(1, 3)));
assert((std::minmax({3, 1, 2}) == std::pair<int, int>(1, 3)));
assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -19,12 +19,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert((std::minmax({1, 2, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
assert((std::minmax({1, 3, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
assert((std::minmax({2, 1, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
assert((std::minmax({2, 3, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)));
assert((std::minmax({3, 1, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
assert((std::minmax({3, 2, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
@@ -41,5 +41,5 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
@@ -37,5 +37,5 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -19,7 +19,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
std::map<int, double, C> m({
@@ -39,5 +39,5 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -20,7 +20,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
typedef test_allocator<std::pair<const int, double> > A;
@@ -42,5 +42,5 @@ int main()
assert(*next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
assert(m.get_allocator() == A(6));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
@@ -39,5 +39,5 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::multimap<int, double> C;
typedef C::value_type V;
C m = {{20, 1}};
@@ -46,5 +46,5 @@ int main()
assert(*++i == V(3, 1));
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::multimap<int, double> C;
typedef C::value_type V;
C m =
@@ -45,5 +45,5 @@ int main()
assert(*++i == V(3, 1));
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -19,7 +19,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef test_compare<std::less<int> > Cmp;
typedef std::multimap<int, double, Cmp> C;
typedef C::value_type V;
@@ -50,5 +50,5 @@ int main()
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -20,7 +20,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef test_compare<std::less<int> > Cmp;
typedef test_allocator<std::pair<const int, double> > A;
typedef std::multimap<int, double, Cmp, A> C;
@@ -53,5 +53,5 @@ int main()
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
assert(m.get_allocator() == A(5));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::multimap<int, double> C;
typedef C::value_type V;
C m =
@@ -49,5 +49,5 @@ int main()
assert(*++i == V(3, 1));
assert(*++i == V(3, 2));
assert(*++i == V(3, 1.5));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -34,5 +34,5 @@ int main()
assert(*++i == V(6));
assert(*++i == V(8));
assert(*++i == V(10));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -32,5 +32,5 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {1, 2, 3, 4, 5, 6};
@@ -31,5 +31,5 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -19,7 +19,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef test_compare<std::less<int> > Cmp;
typedef std::multiset<int, Cmp> C;
typedef C::value_type V;
@@ -34,5 +34,5 @@ int main()
assert(*++i == V(5));
assert(*++i == V(6));
assert(m.key_comp() == Cmp(10));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -20,7 +20,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef test_compare<std::less<int> > Cmp;
typedef test_allocator<int> A;
typedef std::multiset<int, Cmp, A> C;
@@ -37,5 +37,5 @@ int main()
assert(*++i == V(6));
assert(m.key_comp() == Cmp(10));
assert(m.get_allocator() == A(4));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::set<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -34,5 +34,5 @@ int main()
assert(*++i == V(6));
assert(*++i == V(8));
assert(*++i == V(10));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::set<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -32,5 +32,5 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef std::set<int> C;
typedef C::value_type V;
C m = {1, 2, 3, 4, 5, 6};
@@ -31,5 +31,5 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -19,7 +19,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef test_compare<std::less<int> > Cmp;
typedef std::set<int, Cmp> C;
typedef C::value_type V;
@@ -34,5 +34,5 @@ int main()
assert(*++i == V(5));
assert(*++i == V(6));
assert(m.key_comp() == Cmp(10));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -20,7 +20,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef test_compare<std::less<int> > Cmp;
typedef test_allocator<int> A;
typedef std::set<int, Cmp, A> C;
@@ -37,5 +37,5 @@ int main()
assert(*++i == V(6));
assert(m.key_comp() == Cmp(10));
assert(m.get_allocator() == A(4));
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::deque<int> d;
d.assign({3, 4, 5, 6});
assert(d.size() == 4);
@@ -24,5 +24,5 @@ int main()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,12 +16,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::deque<int> d = {3, 4, 5, 6};
assert(d.size() == 4);
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::deque<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
assert(d.size() == 4);
@@ -26,5 +26,5 @@ int main()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::deque<int> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
@@ -24,5 +24,5 @@ int main()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::deque<int> d(10, 1);
std::deque<int>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
assert(d.size() == 14);
@@ -35,5 +35,5 @@ int main()
assert(d[11] == 1);
assert(d[12] == 1);
assert(d[13] == 1);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -17,7 +17,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
typedef std::forward_list<T> C;
@@ -40,5 +40,5 @@ int main()
assert(*i == 10+n);
assert(n == 4);
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -17,7 +17,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
typedef std::forward_list<T> C;
@@ -40,5 +40,5 @@ int main()
assert(*i == 10+n);
assert(n == 4);
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
typedef std::forward_list<T> C;
@@ -26,5 +26,5 @@ int main()
assert(*i == n);
assert(n == 10);
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
typedef test_allocator<T> A;
@@ -30,5 +30,5 @@ int main()
assert(n == 10);
assert(c.get_allocator() == A(14));
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
typedef std::forward_list<T> C;
@@ -42,5 +42,5 @@ int main()
assert(*next(c.begin(), 3) == 1);
assert(*next(c.begin(), 4) == 2);
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::list<int> d;
d.assign({3, 4, 5, 6});
assert(d.size() == 4);
@@ -25,5 +25,5 @@ int main()
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::list<int> d = {3, 4, 5, 6};
assert(d.size() == 4);
std::list<int>::iterator i = d.begin();
@@ -24,5 +24,5 @@ int main()
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::list<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
assert(d.size() == 4);
@@ -27,5 +27,5 @@ int main()
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::list<int> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
@@ -25,5 +25,5 @@ int main()
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::list<int> d(10, 1);
std::list<int>::iterator i = d.insert(next(d.cbegin(), 2), {3, 4, 5, 6});
assert(d.size() == 14);
@@ -36,5 +36,5 @@ int main()
assert(*i++ == 1);
assert(*i++ == 1);
assert(*i++ == 1);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -58,8 +58,6 @@ int main()
assert(c2.empty());
assert(distance(c2.begin(), c2.end()) == 0);
}
#ifndef _LIBCPP_DEBUG_LEVEL
// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
@@ -72,7 +70,6 @@ int main()
assert((c2 == std::list<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
assert(c2.get_allocator() == A(2));
}
#endif
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::vector<int> d;
d.assign({true, false, false, true});
assert(d.size() == 4);
@@ -24,5 +24,5 @@ int main()
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,12 +16,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::vector<int> d = {true, false, false, true};
assert(d.size() == 4);
assert(d[0] == true);
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::vector<int, test_allocator<int>> d({true, false, false, true}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
assert(d.size() == 4);
@@ -26,5 +26,5 @@ int main()
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::vector<bool> d(10, true);
std::vector<bool>::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false});
assert(d.size() == 14);
@@ -35,5 +35,5 @@ int main()
assert(d[11] == true);
assert(d[12] == true);
assert(d[13] == true);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::vector<bool> d;
d = {true, false, false, true};
assert(d.size() == 4);
@@ -24,5 +24,5 @@ int main()
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::vector<int> d;
d.assign({3, 4, 5, 6});
assert(d.size() == 4);
@@ -24,5 +24,5 @@ int main()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,12 +16,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::vector<int> d = {3, 4, 5, 6};
assert(d.size() == 4);
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -18,7 +18,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::vector<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
assert(d.size() == 4);
@@ -26,5 +26,5 @@ int main()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::vector<int> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
@@ -24,5 +24,5 @@ int main()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,7 +16,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
std::vector<int> d(10, 1);
std::vector<int>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
assert(d.size() == 14);
@@ -35,5 +35,5 @@ int main()
assert(d[11] == 1);
assert(d[12] == 1);
assert(d[13] == 1);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -58,8 +58,6 @@ int main()
assert(c2.empty());
assert(distance(c2.begin(), c2.end()) == 0);
}
#ifndef _LIBCPP_DEBUG_LEVEL
// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
@@ -72,7 +70,6 @@ int main()
assert((c2 == std::vector<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
assert(c2.get_allocator() == A(2));
}
#endif
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};

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