Compare commits
84 Commits
svn-tags/l
...
release_30
Author | SHA1 | Date | |
---|---|---|---|
![]() |
699f9ca983 | ||
![]() |
2baccd81f1 | ||
![]() |
11624459ef | ||
![]() |
bc90e2a47d | ||
![]() |
907732644c | ||
![]() |
b97de44471 | ||
![]() |
c6fe8cafc3 | ||
![]() |
fdcbd1db25 | ||
![]() |
e0a0e51248 | ||
![]() |
9677458967 | ||
![]() |
15e48f9239 | ||
![]() |
c0d0cbad9e | ||
![]() |
8452d21f41 | ||
![]() |
f8800b12c5 | ||
![]() |
2481cba8b7 | ||
![]() |
14fa9f9d8f | ||
![]() |
3c466fc631 | ||
![]() |
866569b8c3 | ||
![]() |
efbe4067f2 | ||
![]() |
2ea1ca9bdd | ||
![]() |
0cbb3a16e2 | ||
![]() |
1c3ec6d480 | ||
![]() |
6cd05eeb35 | ||
![]() |
92a07003b2 | ||
![]() |
59832523ac | ||
![]() |
9e02b90405 | ||
![]() |
2fb1a9d1e8 | ||
![]() |
86698890db | ||
![]() |
709c3d27f5 | ||
![]() |
336f41ae0c | ||
![]() |
db2e99f852 | ||
![]() |
a824f53600 | ||
![]() |
eb2c855c44 | ||
![]() |
6b8ac3acda | ||
![]() |
c512df1950 | ||
![]() |
e2f2a15066 | ||
![]() |
e6125bdeae | ||
![]() |
be969d7c7d | ||
![]() |
68ebc448f0 | ||
![]() |
7608b4aac2 | ||
![]() |
0442b12591 | ||
![]() |
abe2628b43 | ||
![]() |
7a563db09a | ||
![]() |
8b3fae3cc7 | ||
![]() |
9cbee430da | ||
![]() |
6b171c557b | ||
![]() |
92a836c03d | ||
![]() |
5f255944ac | ||
![]() |
2b56659c60 | ||
![]() |
3fdbbd2a6f | ||
![]() |
43edf2d1e1 | ||
![]() |
e3e3291f3a | ||
![]() |
8caf423916 | ||
![]() |
8775816ba3 | ||
![]() |
199d0aec1b | ||
![]() |
9d7530935d | ||
![]() |
a73da5d2ca | ||
![]() |
8f0396e443 | ||
![]() |
b59b929cc9 | ||
![]() |
70bbcae9b5 | ||
![]() |
d50c1c7429 | ||
![]() |
110b8bf57e | ||
![]() |
affd9e5d43 | ||
![]() |
e36a196049 | ||
![]() |
23369ee812 | ||
![]() |
db86663223 | ||
![]() |
9c59d38112 | ||
![]() |
d36369d910 | ||
![]() |
4f598034d2 | ||
![]() |
fa06d75e8d | ||
![]() |
2644a7b3da | ||
![]() |
099084d52f | ||
![]() |
b3296ae5bc | ||
![]() |
bf6666f7a0 | ||
![]() |
541cb301a1 | ||
![]() |
13aaf422e4 | ||
![]() |
e6440c6fa2 | ||
![]() |
737a351850 | ||
![]() |
2d81f3d1f3 | ||
![]() |
464aa5cad3 | ||
![]() |
bcbbd4d14f | ||
![]() |
9a2078137f | ||
![]() |
a78264f872 | ||
![]() |
f3907e6cc0 |
12
CREDITS.TXT
12
CREDITS.TXT
@@ -20,3 +20,15 @@ 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.
|
||||
|
35
Makefile
35
Makefile
@@ -29,13 +29,34 @@ clean::
|
||||
|
||||
installhdrs::
|
||||
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/include
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/*
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext/*
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
|
||||
|
||||
install:: installhdrs $(DESTDIR)
|
||||
|
||||
|
@@ -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, fa
|
||||
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>);
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#define _LIBCPP_VERSION 1000
|
||||
#define _LIBCPP_VERSION 1001
|
||||
|
||||
#define _LIBCPP_ABI_VERSION 1
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
#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)
|
||||
@@ -146,6 +150,9 @@ 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
|
||||
|
||||
@@ -157,6 +164,14 @@ 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
|
||||
@@ -188,6 +203,10 @@ 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__)
|
||||
@@ -237,6 +256,7 @@ 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)
|
||||
@@ -285,12 +305,32 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _LIBCPP_STABLE_APPLE_ABI
|
||||
#if __APPLE__ || __FreeBSD__ || _WIN32
|
||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if __APPLE__ || __FreeBSD__
|
||||
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __FreeBSD__
|
||||
#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
|
||||
|
191
include/__debug
Normal file
191
include/__debug
Normal file
@@ -0,0 +1,191 @@
|
||||
// -*- 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
|
||||
|
@@ -432,9 +432,10 @@ public:
|
||||
bool __value_constructed;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_node_destructor(allocator_type& __na) _NOEXCEPT
|
||||
explicit __hash_node_destructor(allocator_type& __na,
|
||||
bool __constructed = false) _NOEXCEPT
|
||||
: __na_(__na),
|
||||
__value_constructed(false)
|
||||
__value_constructed(__constructed)
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1753,7 +1754,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()));
|
||||
return __node_holder(__cn, _D(__node_alloc(), true));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
|
@@ -19,7 +19,11 @@
|
||||
#include <cstdint>
|
||||
#include <cctype>
|
||||
#include <locale.h>
|
||||
#include <xlocale.h>
|
||||
#if _WIN32
|
||||
# include <support/win32/locale_win32.h>
|
||||
#elif (__GLIBC__ || __APPLE__ || __FreeBSD__)
|
||||
# include <xlocale.h>
|
||||
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
@@ -227,18 +231,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>;
|
||||
@@ -302,24 +306,8 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
||||
class _LIBCPP_VISIBLE ctype_base
|
||||
{
|
||||
public:
|
||||
#ifdef __GLIBC__
|
||||
#if __GLIBC__
|
||||
typedef unsigned short mask;
|
||||
#else
|
||||
typedef __uint32_t mask;
|
||||
#endif
|
||||
|
||||
#if __APPLE__
|
||||
static const mask space = _CTYPE_S;
|
||||
static const mask print = _CTYPE_R;
|
||||
static const mask cntrl = _CTYPE_C;
|
||||
static const mask upper = _CTYPE_U;
|
||||
static const mask lower = _CTYPE_L;
|
||||
static const mask alpha = _CTYPE_A;
|
||||
static const mask digit = _CTYPE_D;
|
||||
static const mask punct = _CTYPE_P;
|
||||
static const mask xdigit = _CTYPE_X;
|
||||
static const mask blank = _CTYPE_B;
|
||||
#else // __APPLE__
|
||||
static const mask space = _ISspace;
|
||||
static const mask print = _ISprint;
|
||||
static const mask cntrl = _IScntrl;
|
||||
@@ -330,7 +318,47 @@ public:
|
||||
static const mask punct = _ISpunct;
|
||||
static const mask xdigit = _ISxdigit;
|
||||
static const mask blank = _ISblank;
|
||||
#endif // __APPLE__
|
||||
#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__
|
||||
typedef __uint32_t mask;
|
||||
#elif __FreeBSD__
|
||||
typedef unsigned long mask;
|
||||
#endif
|
||||
static const mask space = _CTYPE_S;
|
||||
static const mask print = _CTYPE_R;
|
||||
static const mask cntrl = _CTYPE_C;
|
||||
static const mask upper = _CTYPE_U;
|
||||
static const mask lower = _CTYPE_L;
|
||||
static const mask alpha = _CTYPE_A;
|
||||
static const mask digit = _CTYPE_D;
|
||||
static const mask punct = _CTYPE_P;
|
||||
static const mask xdigit = _CTYPE_X;
|
||||
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__
|
||||
static const mask alnum = alpha | digit;
|
||||
static const mask graph = alnum | punct;
|
||||
|
||||
@@ -541,7 +569,7 @@ public:
|
||||
#endif
|
||||
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
|
||||
static const mask* classic_table() _NOEXCEPT;
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
#if defined(__GLIBC__)
|
||||
static const int* __classic_upper_table() _NOEXCEPT;
|
||||
static const int* __classic_lower_table() _NOEXCEPT;
|
||||
#endif
|
||||
|
@@ -141,14 +141,14 @@ public:
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const __split_buffer& __c, true_type)
|
||||
void __move_assign_alloc(__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(const __split_buffer& __c, false_type) _NOEXCEPT
|
||||
void __move_assign_alloc(__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_), value_type());
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
|
@@ -593,9 +593,6 @@ template <class BidirectionalIterator, class Compare>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <iterator>
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#include <cassert>
|
||||
#endif
|
||||
#include <cstdlib>
|
||||
|
||||
#pragma GCC system_header
|
||||
@@ -676,7 +673,7 @@ public:
|
||||
bool operator()(const _T1& __x, const _T2& __y) {return !__p_(__x, __y);}
|
||||
};
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
|
||||
template <class _Compare>
|
||||
struct __debug_less
|
||||
@@ -688,12 +685,12 @@ struct __debug_less
|
||||
{
|
||||
bool __r = __comp_(__x, __y);
|
||||
if (__r)
|
||||
assert(!__comp_(__y, __x));
|
||||
_LIBCPP_ASSERT(!__comp_(__y, __x), "Comparator does not induce a strict weak ordering");
|
||||
return __r;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
|
||||
// Precondition: __x != 0
|
||||
inline _LIBCPP_INLINE_VISIBILITY unsigned __ctz(unsigned __x) {return __builtin_ctz (__x);}
|
||||
@@ -2233,6 +2230,8 @@ 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
|
||||
@@ -2249,6 +2248,8 @@ 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>
|
||||
@@ -2293,6 +2294,8 @@ 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
|
||||
@@ -2309,6 +2312,8 @@ 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>
|
||||
@@ -2388,6 +2393,8 @@ 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>
|
||||
@@ -2408,6 +2415,8 @@ 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
|
||||
@@ -3629,14 +3638,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
__sort<_Comp_ref>(__first, __last, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
__sort<_Comp_ref>(__first, __last, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
@@ -3663,6 +3672,15 @@ 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>&);
|
||||
@@ -3726,14 +3744,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __lower_bound<_Comp_ref>(__first, __last, __value, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __lower_bound<_Comp_ref>(__first, __last, __value, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
@@ -3774,14 +3792,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __upper_bound<_Comp_ref>(__first, __last, __value, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __upper_bound<_Comp_ref>(__first, __last, __value, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
@@ -3834,14 +3852,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
pair<_ForwardIterator, _ForwardIterator>
|
||||
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __equal_range<_Comp_ref>(__first, __last, __value, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __equal_range<_Comp_ref>(__first, __last, __value, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
@@ -3869,14 +3887,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __binary_search<_Comp_ref>(__first, __last, __value, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __binary_search<_Comp_ref>(__first, __last, __value, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
@@ -3919,14 +3937,14 @@ _OutputIterator
|
||||
merge(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
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_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
|
||||
@@ -4093,16 +4111,16 @@ inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _
|
||||
__buf = _VSTD::get_temporary_buffer<value_type>(__buf_size);
|
||||
__h.reset(__buf.first);
|
||||
}
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
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_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
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_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator>
|
||||
@@ -4304,14 +4322,14 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar
|
||||
__buf = _VSTD::get_temporary_buffer<value_type>(__len);
|
||||
__h.reset(__buf.first);
|
||||
}
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
__stable_sort<_Comp_ref>(__first, __last, __c, __len, __buf.first, __buf.second);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
__stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
@@ -4453,14 +4471,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
__push_heap_back<_Comp_ref>(__first, __last, __c, __last - __first);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
__push_heap_back<_Comp_ref>(__first, __last, __comp, __last - __first);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
@@ -4491,14 +4509,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
__pop_heap<_Comp_ref>(__first, __last, __c, __last - __first);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
__pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
@@ -4531,14 +4549,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
__make_heap<_Comp_ref>(__first, __last, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
__make_heap<_Comp_ref>(__first, __last, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
@@ -4565,14 +4583,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
__sort_heap<_Comp_ref>(__first, __last, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
__sort_heap<_Comp_ref>(__first, __last, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
@@ -4609,14 +4627,14 @@ void
|
||||
partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
|
||||
_Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
__partial_sort<_Comp_ref>(__first, __middle, __last, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
__partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
@@ -4659,14 +4677,14 @@ _RandomAccessIterator
|
||||
partial_sort_copy(_InputIterator __first, _InputIterator __last,
|
||||
_RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _RandomAccessIterator>
|
||||
@@ -4871,14 +4889,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
__nth_element<_Comp_ref>(__first, __nth, __last, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
__nth_element<_Comp_ref>(__first, __nth, __last, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
@@ -4912,14 +4930,14 @@ bool
|
||||
includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
|
||||
_Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
@@ -4965,14 +4983,14 @@ _OutputIterator
|
||||
set_union(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
|
||||
@@ -5017,14 +5035,14 @@ _OutputIterator
|
||||
set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
|
||||
@@ -5071,14 +5089,14 @@ _OutputIterator
|
||||
set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
|
||||
@@ -5130,14 +5148,14 @@ _OutputIterator
|
||||
set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
|
||||
@@ -5174,14 +5192,14 @@ bool
|
||||
lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
@@ -5229,14 +5247,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __next_permutation<_Comp_ref>(__first, __last, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __next_permutation<_Comp_ref>(__first, __last, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator>
|
||||
@@ -5282,14 +5300,14 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __prev_permutation<_Comp_ref>(__first, __last, __c);
|
||||
#else // _LIBCPP_DEBUG
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __prev_permutation<_Comp_ref>(__first, __last, __comp);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator>
|
||||
|
@@ -1033,6 +1033,14 @@ 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
|
||||
|
316
include/cerrno
316
include/cerrno
@@ -72,4 +72,320 @@ 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
|
||||
|
@@ -106,6 +106,9 @@ 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
|
||||
|
||||
|
@@ -977,14 +977,14 @@ protected:
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const __deque_base& __c, true_type)
|
||||
void __move_assign_alloc(__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(const __deque_base& __c, false_type) _NOEXCEPT
|
||||
void __move_assign_alloc(__deque_base& __c, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1204,12 +1204,16 @@ 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);
|
||||
@@ -1227,8 +1231,10 @@ 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;
|
||||
|
||||
@@ -1313,9 +1319,11 @@ 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);
|
||||
@@ -1452,6 +1460,8 @@ 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)
|
||||
{
|
||||
@@ -1465,6 +1475,8 @@ 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)
|
||||
|
46
include/ext/__hash
Normal file
46
include/ext/__hash
Normal file
@@ -0,0 +1,46 @@
|
||||
// -*- 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
|
@@ -203,8 +203,11 @@ 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
|
||||
|
||||
@@ -466,6 +469,7 @@ 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;
|
||||
@@ -549,6 +553,8 @@ 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);
|
||||
|
||||
@@ -742,6 +748,7 @@ 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;
|
||||
@@ -823,6 +830,8 @@ 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);
|
||||
|
||||
|
@@ -196,14 +196,17 @@ 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 = std::hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class _LIBCPP_VISIBLE hash_set
|
||||
{
|
||||
@@ -272,6 +275,8 @@ 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);
|
||||
|
||||
@@ -490,6 +495,8 @@ 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);
|
||||
|
||||
|
@@ -580,8 +580,10 @@ 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;
|
||||
|
||||
@@ -592,7 +594,9 @@ 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
|
||||
@@ -602,7 +606,9 @@ 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
|
||||
@@ -677,8 +683,10 @@ 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);
|
||||
@@ -843,6 +851,8 @@ 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)
|
||||
{
|
||||
@@ -857,6 +867,8 @@ 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)
|
||||
@@ -910,6 +922,8 @@ 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>&
|
||||
@@ -919,6 +933,8 @@ 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
|
||||
@@ -954,6 +970,8 @@ 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
|
||||
@@ -962,6 +980,8 @@ 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
|
||||
|
||||
|
@@ -51,6 +51,8 @@ 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
|
||||
{
|
||||
@@ -94,6 +96,8 @@ end(initializer_list<_E> __il) _NOEXCEPT
|
||||
return __il.end();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
} // std
|
||||
|
||||
#endif // _LIBCPP_INITIALIZER_LIST
|
||||
|
384
include/istream
384
include/istream
@@ -742,26 +742,29 @@ 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());
|
||||
_I __i(__is);
|
||||
_I __eof;
|
||||
for (; __i != __eof && __c < __n-1; ++__i, ++__s, ++__c)
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
while (__c < __n-1)
|
||||
{
|
||||
_CharT __ch = *__i;
|
||||
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 (__ct.is(__ct.space, __ch))
|
||||
break;
|
||||
*__s = __ch;
|
||||
*__s++ = __ch;
|
||||
++__c;
|
||||
__is.rdbuf()->sbumpc();
|
||||
}
|
||||
*__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);
|
||||
@@ -803,25 +806,11 @@ 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
|
||||
}
|
||||
@@ -861,42 +850,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
|
||||
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)
|
||||
{
|
||||
*__o = *__i;
|
||||
if (__o.failed())
|
||||
break;
|
||||
}
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
if (__i == __eof)
|
||||
__err |= ios_base::eofbit;
|
||||
if (__c == 0)
|
||||
while (true)
|
||||
{
|
||||
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()))
|
||||
break;
|
||||
++__gc_;
|
||||
this->rdbuf()->sbumpc();
|
||||
}
|
||||
if (__gc_ == 0)
|
||||
__err |= ios_base::failbit;
|
||||
this->setstate(__err);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (__c == 0)
|
||||
if (__gc_ == 0)
|
||||
this->__set_failbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
else
|
||||
this->setstate(ios_base::failbit);
|
||||
__gc_ = __c;
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -921,22 +910,11 @@ basic_istream<_CharT, _Traits>::get()
|
||||
sentry __s(*this, true);
|
||||
if (__s)
|
||||
{
|
||||
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;
|
||||
}
|
||||
__r = this->rdbuf()->sbumpc();
|
||||
if (traits_type::eq_int_type(__r, traits_type::eof()))
|
||||
this->setstate(ios_base::failbit | ios_base::eofbit);
|
||||
else
|
||||
__err |= ios_base::failbit | ios_base::eofbit;
|
||||
this->setstate(__err);
|
||||
__gc_ = __c;
|
||||
__gc_ = 1;
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -971,30 +949,31 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
|
||||
sentry __sen(*this, true);
|
||||
if (__sen)
|
||||
{
|
||||
streamsize __c = 0;
|
||||
if (__n > 0)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
_I __i(*this);
|
||||
_I __eof;
|
||||
for (; __i != __eof && __n > 1; ++__i, ++__s, ++__c)
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
while (__gc_ < __n-1)
|
||||
{
|
||||
char_type __ch = *__i;
|
||||
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);
|
||||
if (traits_type::eq(__ch, __dlm))
|
||||
break;
|
||||
*__s = __ch;
|
||||
*__s++ = __ch;
|
||||
++__gc_;
|
||||
this->rdbuf()->sbumpc();
|
||||
}
|
||||
*__s = char_type();
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
if (__i == __eof)
|
||||
__err |= ios_base::eofbit;
|
||||
if (__c == 0)
|
||||
if (__gc_ == 0)
|
||||
__err |= ios_base::failbit;
|
||||
this->setstate(__err);
|
||||
}
|
||||
else
|
||||
this->setstate(ios_base::failbit);
|
||||
__gc_ = __c;
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -1027,38 +1006,36 @@ 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
|
||||
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)
|
||||
while (true)
|
||||
{
|
||||
char_type __ch = *__i;
|
||||
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);
|
||||
if (traits_type::eq(__ch, __dlm))
|
||||
break;
|
||||
*__o = __ch;
|
||||
if (__o.failed())
|
||||
if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
|
||||
break;
|
||||
++__gc_;
|
||||
this->rdbuf()->sbumpc();
|
||||
}
|
||||
if (__i == __eof)
|
||||
__err |= ios_base::eofbit;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
if (__c == 0)
|
||||
if (__gc_ == 0)
|
||||
__err |= ios_base::failbit;
|
||||
this->setstate(__err);
|
||||
__gc_ = __c;
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -1090,33 +1067,36 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
|
||||
sentry __sen(*this, true);
|
||||
if (__sen)
|
||||
{
|
||||
streamsize __c = 0;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
_I __i(*this);
|
||||
_I __eof;
|
||||
for (; __i != __eof; ++__s, --__n)
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
while (true)
|
||||
{
|
||||
char_type __ch = *__i;
|
||||
++__i;
|
||||
++__c;
|
||||
if (traits_type::eq(__ch, __dlm))
|
||||
break;
|
||||
if (__n < 2)
|
||||
typename traits_type::int_type __i = this->rdbuf()->sgetc();
|
||||
if (traits_type::eq_int_type(__i, traits_type::eof()))
|
||||
{
|
||||
this->setstate(ios_base::failbit);
|
||||
__err |= ios_base::eofbit;
|
||||
break;
|
||||
}
|
||||
char_type __ch = traits_type::to_char_type(__i);
|
||||
if (traits_type::eq(__ch, __dlm))
|
||||
{
|
||||
this->rdbuf()->sbumpc();
|
||||
++__gc_;
|
||||
break;
|
||||
}
|
||||
*__s = __ch;
|
||||
if (__gc_ >= __n-1)
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
break;
|
||||
}
|
||||
*__s++ = __ch;
|
||||
this->rdbuf()->sbumpc();
|
||||
++__gc_;
|
||||
}
|
||||
if (__n)
|
||||
if (__n > 0)
|
||||
*__s = char_type();
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
if (__i == __eof)
|
||||
__err |= ios_base::eofbit;
|
||||
if (__c == 0)
|
||||
if (__gc_ == 0)
|
||||
__err |= ios_base::failbit;
|
||||
this->setstate(__err);
|
||||
__gc_ = __c;
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -1148,35 +1128,40 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
|
||||
sentry __sen(*this, true);
|
||||
if (__sen)
|
||||
{
|
||||
streamsize __c = 0;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
_I __i(*this);
|
||||
_I __eof;
|
||||
if (__n != numeric_limits<streamsize>::max())
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
if (__n == numeric_limits<streamsize>::max())
|
||||
{
|
||||
for (; __n > 0 && __i != __eof; --__n)
|
||||
while (true)
|
||||
{
|
||||
char_type __ch = *__i;
|
||||
++__i;
|
||||
++__c;
|
||||
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);
|
||||
if (traits_type::eq(__ch, __dlm))
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (__i != __eof)
|
||||
while (__gc_ < __n)
|
||||
{
|
||||
char_type __ch = *__i;
|
||||
++__i;
|
||||
++__c;
|
||||
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);
|
||||
if (traits_type::eq(__ch, __dlm))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (__i == __eof)
|
||||
this->setstate(ios_base::eofbit);
|
||||
__gc_ = __c;
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -1223,20 +1208,17 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
|
||||
sentry __sen(*this, true);
|
||||
if (__sen)
|
||||
{
|
||||
streamsize __c = 0;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
_I __i(*this);
|
||||
_I __eof;
|
||||
for (; __i != __eof && __n > 0; ++__i, ++__s, ++__c, --__n)
|
||||
*__s = *__i;
|
||||
if (__i == __eof)
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
for (; __gc_ < __n; ++__gc_)
|
||||
{
|
||||
ios_base::iostate __err = ios_base::eofbit;
|
||||
if (__n > 0)
|
||||
__err |= ios_base::failbit;
|
||||
this->setstate(__err);
|
||||
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);
|
||||
}
|
||||
__gc_ = __c;
|
||||
}
|
||||
else
|
||||
this->setstate(ios_base::failbit);
|
||||
@@ -1254,45 +1236,19 @@ template<class _CharT, class _Traits>
|
||||
streamsize
|
||||
basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
|
||||
{
|
||||
__gc_ = 0;
|
||||
streamsize __c = 0;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
streamsize __c = this->rdbuf()->in_avail();
|
||||
switch (__c)
|
||||
{
|
||||
#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
|
||||
case -1:
|
||||
this->setstate(ios_base::eofbit);
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
read(__s, _VSTD::min(__c, __n));
|
||||
break;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __c;
|
||||
return __gc_;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
@@ -1455,15 +1411,19 @@ 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());
|
||||
_I __i(__is);
|
||||
_I __eof;
|
||||
for (; __i != __eof; ++__i)
|
||||
if (!__ct.is(__ct.space, *__i))
|
||||
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)))
|
||||
break;
|
||||
if (__i == __eof)
|
||||
__is.setstate(ios_base::failbit | ios_base::eofbit);
|
||||
__is.rdbuf()->sbumpc();
|
||||
}
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -1572,27 +1532,30 @@ 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());
|
||||
_I __i(__is);
|
||||
_I __eof;
|
||||
for (; __i != __eof && __c < __n; ++__i, ++__c)
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
while (__c < __n)
|
||||
{
|
||||
_CharT __ch = *__i;
|
||||
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 (__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);
|
||||
@@ -1622,31 +1585,28 @@ getline(basic_istream<_CharT, _Traits>& __is,
|
||||
if (__sen)
|
||||
{
|
||||
__str.clear();
|
||||
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;)
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
streamsize __extr = 0;
|
||||
while (true)
|
||||
{
|
||||
_CharT __ch = *__i;
|
||||
++__i;
|
||||
++__c;
|
||||
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);
|
||||
if (_Traits::eq(__ch, __dlm))
|
||||
break;
|
||||
if (__c == __n)
|
||||
__str.push_back(__ch);
|
||||
if (__str.size() == __str.max_size())
|
||||
{
|
||||
__is.setstate(ios_base::failbit);
|
||||
__err |= ios_base::failbit;
|
||||
break;
|
||||
}
|
||||
__str.push_back(__ch);
|
||||
}
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
if (__i == __eof)
|
||||
__err |= ios_base::eofbit;
|
||||
if (__c == 0)
|
||||
if (__extr == 0)
|
||||
__err |= ios_base::failbit;
|
||||
__is.setstate(__err);
|
||||
}
|
||||
@@ -1704,24 +1664,26 @@ 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');
|
||||
_I __i(__is);
|
||||
_I __eof;
|
||||
for (; __i != __eof && __c < _Size; ++__i, ++__c)
|
||||
while (__c < _Size)
|
||||
{
|
||||
_CharT __ch = *__i;
|
||||
if (__ch != __zero && __ch != __one)
|
||||
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))
|
||||
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);
|
||||
|
128
include/iterator
128
include/iterator
@@ -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, const __wrap_iter<_Iter>&) _NOEXCEPT;
|
||||
operator+(typename __wrap_iter<_Iter>::difference_type, __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,33 +1063,108 @@ public:
|
||||
private:
|
||||
iterator_type __i;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
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()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT {return *__i;}
|
||||
: __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;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return &(operator*());}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT {++__i; return *this;}
|
||||
_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++(int) _NOEXCEPT
|
||||
{__wrap_iter __tmp(*this); ++__i; return __tmp;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT {--__i; return *this;}
|
||||
{__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;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _NOEXCEPT
|
||||
{__wrap_iter __tmp(*this); --__i; return __tmp;}
|
||||
{__wrap_iter __tmp(*this); --(*this); return __tmp;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT
|
||||
{return __wrap_iter(__i + __n);}
|
||||
{__wrap_iter __w(*this); __w += __n; return __w;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
|
||||
{__i += __n; return *this;}
|
||||
{
|
||||
#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;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _NOEXCEPT
|
||||
{return __wrap_iter(__i - __n);}
|
||||
{return *this + (-__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
|
||||
{__i -= __n; return *this;}
|
||||
{*this += -__n; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT
|
||||
{return __i[__n];}
|
||||
{
|
||||
#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];
|
||||
}
|
||||
|
||||
_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;
|
||||
@@ -1133,7 +1208,7 @@ private:
|
||||
template <class _Iter1>
|
||||
friend
|
||||
__wrap_iter<_Iter1>
|
||||
operator+(typename __wrap_iter<_Iter1>::difference_type, const __wrap_iter<_Iter1>&) _NOEXCEPT;
|
||||
operator+(typename __wrap_iter<_Iter1>::difference_type, __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);
|
||||
@@ -1155,6 +1230,10 @@ 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();
|
||||
}
|
||||
|
||||
@@ -1163,6 +1242,10 @@ 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();
|
||||
}
|
||||
|
||||
@@ -1171,7 +1254,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() != __y.base();
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
@@ -1179,7 +1262,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() > __y.base();
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
@@ -1187,7 +1270,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() >= __y.base();
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
@@ -1195,7 +1278,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() <= __y.base();
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
@@ -1203,6 +1286,10 @@ 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();
|
||||
}
|
||||
|
||||
@@ -1210,9 +1297,10 @@ template <class _Iter>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__wrap_iter<_Iter>
|
||||
operator+(typename __wrap_iter<_Iter>::difference_type __n,
|
||||
const __wrap_iter<_Iter>& __x) _NOEXCEPT
|
||||
__wrap_iter<_Iter> __x) _NOEXCEPT
|
||||
{
|
||||
return __wrap_iter<_Iter>(__x.base() + __n);
|
||||
__x += __n;
|
||||
return __x;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
|
671
include/list
671
include/list
File diff suppressed because it is too large
Load Diff
449
include/locale
449
include/locale
@@ -186,160 +186,221 @@ 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
|
||||
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
// Get the C locale object
|
||||
locale_t __cloc();
|
||||
#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
|
||||
#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.
|
||||
#if __APPLE__
|
||||
#ifdef __linux__
|
||||
|
||||
template <class _Tp>
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_sprintf(char* __restrict __str,
|
||||
const char* __restrict __format, _Tp __v)
|
||||
__mb_cur_max_l(locale_t __l)
|
||||
{
|
||||
return sprintf_l(__str, 0, __format, __v);
|
||||
return MB_CUR_MAX_L(__l);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, _Tp __v)
|
||||
#else // _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
decltype(MB_CUR_MAX) __mb_cur_max_l(locale_t __l)
|
||||
{
|
||||
return snprintf_l(__str, __size, 0, __format, __v);
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return MB_CUR_MAX;
|
||||
}
|
||||
#endif // _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, int __prec, _Tp __v)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
wint_t __btowc_l(int __c, locale_t __l)
|
||||
{
|
||||
return snprintf_l(__str, __size, 0, __format, __prec, __v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
|
||||
{
|
||||
return asprintf_l(__ret, 0, __format, __v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
|
||||
_Tp __v)
|
||||
{
|
||||
return asprintf_l(__ret, 0, __format, __prec, __v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_sscanf(const char* __restrict __str,
|
||||
const char* __restrict __format, _Tp* __v)
|
||||
{
|
||||
return sscanf_l(__str, 0, __format, __v);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isxdigit(int __c)
|
||||
{
|
||||
return isxdigit_l(__c, 0);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isdigit(int __c)
|
||||
{
|
||||
return isdigit_l(__c, 0);
|
||||
}
|
||||
|
||||
#else // __APPLE__
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return btowc_l(__c, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return btowc(__c);
|
||||
#endif
|
||||
int
|
||||
__nolocale_sprintf(char* __restrict __str,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vsprintf(__str, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
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, ...)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vsnprintf(__str, __size, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_asprintf(char** __ret,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vasprintf(__ret, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_sscanf(const char* __restrict __str,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isdigit(int __c)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __wctob_l(wint_t __c, locale_t __l)
|
||||
{
|
||||
return isdigit(__c);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return wctob_l(__c, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return wctob(__c);
|
||||
#endif
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
_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)
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
_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)
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
|
||||
mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
lconv *__localeconv_l(locale_t __l)
|
||||
{
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return localeconv_l(__l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return localeconv();
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
|
||||
mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
_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;
|
||||
}
|
||||
|
||||
_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__
|
||||
|
||||
// __scan_keyword
|
||||
// Scans [__b, __e) until a match is found in the basic_strings range
|
||||
@@ -753,7 +814,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, 0);
|
||||
long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
|
||||
int __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
@@ -793,7 +854,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, 0);
|
||||
unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
|
||||
int __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
@@ -821,7 +882,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, 0);
|
||||
long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE);
|
||||
if (__p2 != __a_end)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
@@ -1226,7 +1287,11 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
break;
|
||||
// Stage 3
|
||||
__a[sizeof(__a)-1] = 0;
|
||||
if (__nolocale_sscanf(__a, "%p", &__v) != 1)
|
||||
#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
|
||||
__err = ios_base::failbit;
|
||||
// EOF checked
|
||||
if (__b == __e)
|
||||
@@ -1331,13 +1396,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 (!__nolocale_isxdigit(*__ns))
|
||||
if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (__ns = __nf; __ns < __ne; ++__ns)
|
||||
if (!__nolocale_isdigit(*__ns))
|
||||
if (!isdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
|
||||
break;
|
||||
}
|
||||
if (__grouping.empty())
|
||||
@@ -1535,7 +1600,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#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
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1561,7 +1630,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<long long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#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
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1587,7 +1660,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<unsigned long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#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
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1613,7 +1690,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<unsigned long long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#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
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1640,18 +1721,35 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char* __nb = __nar;
|
||||
int __nc;
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#endif
|
||||
else
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
|
||||
#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
|
||||
unique_ptr<char, void(*)(void*)> __nbh(0, free);
|
||||
if (__nc > static_cast<int>(__nbuf-1))
|
||||
{
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
|
||||
__v);
|
||||
#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
|
||||
else
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
|
||||
#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
|
||||
if (__nb == 0)
|
||||
__throw_bad_alloc();
|
||||
__nbh.reset(__nb);
|
||||
@@ -1692,18 +1790,35 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char* __nb = __nar;
|
||||
int __nc;
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#endif
|
||||
else
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
|
||||
#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
|
||||
unique_ptr<char, void(*)(void*)> __nbh(0, free);
|
||||
if (__nc > static_cast<int>(__nbuf-1))
|
||||
{
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
|
||||
__v);
|
||||
#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
|
||||
else
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
if (__nb == 0)
|
||||
__throw_bad_alloc();
|
||||
__nbh.reset(__nb);
|
||||
@@ -1739,7 +1854,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char __fmt[6] = "%p";
|
||||
const unsigned __nbuf = 20;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#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
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar
|
||||
@@ -2516,11 +2635,7 @@ class __time_put
|
||||
{
|
||||
locale_t __loc_;
|
||||
protected:
|
||||
#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
|
||||
_LIBCPP_ALWAYS_INLINE __time_put() : __loc_(_LIBCPP_GET_C_LOCALE) {}
|
||||
__time_put(const char* __nm);
|
||||
__time_put(const string& __nm);
|
||||
~__time_put();
|
||||
@@ -3423,7 +3538,11 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
// secure memory for digit storage
|
||||
if (__n > __bs-1)
|
||||
{
|
||||
__n = __nolocale_asprintf(&__bb, "%.0Lf", __units);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__n = asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
|
||||
#else
|
||||
__n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
|
||||
#endif
|
||||
if (__bb == 0)
|
||||
__throw_bad_alloc();
|
||||
__hn.reset(__bb);
|
||||
@@ -3574,10 +3693,14 @@ template <class _CharT>
|
||||
typename messages<_CharT>::catalog
|
||||
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
|
||||
{
|
||||
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
|
||||
#if _WIN32
|
||||
return -1;
|
||||
#else // _WIN32
|
||||
catalog __cat = (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>
|
||||
@@ -3585,28 +3708,34 @@ 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 = reinterpret_cast<nl_catd>(__c);
|
||||
nl_catd __cat = (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 = reinterpret_cast<nl_catd>(__c);
|
||||
nl_catd __cat = (nl_catd)__c;
|
||||
catclose(__cat);
|
||||
#endif // !_WIN32
|
||||
}
|
||||
|
||||
extern template class messages<char>;
|
||||
|
53
include/map
53
include/map
@@ -773,6 +773,18 @@ 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))
|
||||
@@ -787,14 +799,6 @@ 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)
|
||||
{
|
||||
@@ -802,7 +806,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit map(const allocator_type& __a)
|
||||
@@ -943,10 +947,14 @@ 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
|
||||
@@ -1522,6 +1530,18 @@ 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))
|
||||
@@ -1536,21 +1556,14 @@ 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_RVALUE_REFERENCES
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit multimap(const allocator_type& __a)
|
||||
@@ -1679,10 +1692,14 @@ 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
|
||||
|
@@ -595,6 +595,7 @@ 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
|
||||
@@ -1293,7 +1294,7 @@ struct __has_allocate_hint
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#if !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
|
||||
template <class _Alloc, class _Tp, class ..._Args>
|
||||
decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Tp*>(),
|
||||
@@ -2902,9 +2903,7 @@ 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;
|
||||
};
|
||||
@@ -4148,6 +4147,11 @@ 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
|
||||
{
|
||||
|
@@ -2562,8 +2562,11 @@ 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>(
|
||||
(__e() + ((uint64_t)__e() << 32)) & _Max);
|
||||
(__e0 + ((uint64_t)__e() << 32)) & _Max);
|
||||
}
|
||||
__c_ = __x_[__r-1] == 0;
|
||||
__i_ = 0;
|
||||
}
|
||||
@@ -3399,9 +3402,11 @@ 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
|
||||
@@ -5715,9 +5720,11 @@ 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);
|
||||
@@ -5760,9 +5767,11 @@ 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,
|
||||
@@ -5942,8 +5951,10 @@ 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);
|
||||
@@ -5993,11 +6004,13 @@ 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
|
||||
@@ -6127,6 +6140,8 @@ 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(
|
||||
@@ -6150,6 +6165,8 @@ 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(
|
||||
@@ -6258,8 +6275,10 @@ 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);
|
||||
@@ -6309,11 +6328,13 @@ 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
|
||||
@@ -6447,6 +6468,8 @@ 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(
|
||||
@@ -6470,6 +6493,8 @@ 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(
|
||||
|
@@ -2478,12 +2478,14 @@ 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;
|
||||
|
||||
@@ -2492,9 +2494,11 @@ 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)
|
||||
@@ -2557,11 +2561,15 @@ 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_;}
|
||||
@@ -5202,11 +5210,11 @@ public:
|
||||
const_reference suffix() const {return __suffix_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;}
|
||||
const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __matches_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;}
|
||||
const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return __matches_.end();}
|
||||
|
||||
@@ -6069,11 +6077,13 @@ 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,
|
||||
@@ -6162,6 +6172,8 @@ 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,
|
||||
@@ -6175,6 +6187,8 @@ 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>::
|
||||
|
@@ -437,6 +437,7 @@ 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)
|
||||
@@ -458,6 +459,7 @@ 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
|
||||
@@ -542,9 +544,11 @@ 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);}
|
||||
@@ -771,6 +775,7 @@ 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)
|
||||
@@ -792,6 +797,7 @@ 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
|
||||
@@ -876,9 +882,11 @@ 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);}
|
||||
|
215
include/string
215
include/string
@@ -1150,10 +1150,12 @@ 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();
|
||||
|
||||
@@ -1166,8 +1168,10 @@ 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
|
||||
@@ -1240,7 +1244,9 @@ 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);
|
||||
@@ -1263,8 +1269,10 @@ 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
|
||||
@@ -1300,8 +1308,10 @@ 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);
|
||||
@@ -1327,9 +1337,11 @@ 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
|
||||
@@ -1358,9 +1370,11 @@ 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
|
||||
@@ -1577,6 +1591,27 @@ 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 ||
|
||||
@@ -1942,6 +1977,8 @@ 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)
|
||||
@@ -1957,6 +1994,8 @@ 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()
|
||||
{
|
||||
@@ -2120,7 +2159,8 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
__r_ = _VSTD::move(__str.__r_);
|
||||
__r_.first() = __str.__r_.first();
|
||||
__move_assign_alloc(__str);
|
||||
__str.__zero();
|
||||
}
|
||||
|
||||
@@ -3392,7 +3432,17 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
int
|
||||
basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
|
||||
{
|
||||
return compare(0, npos, __str.data(), __str.size());
|
||||
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;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3507,24 +3557,6 @@ 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
|
||||
@@ -3534,24 +3566,6 @@ 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>
|
||||
@@ -3589,25 +3603,7 @@ bool
|
||||
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
|
||||
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
|
||||
{
|
||||
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;
|
||||
return __lhs.compare(__rhs) < 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3616,25 +3612,7 @@ bool
|
||||
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
|
||||
const _CharT* __rhs) _NOEXCEPT
|
||||
{
|
||||
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;
|
||||
return __lhs.compare(__rhs) < 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3646,24 +3624,6 @@ 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>
|
||||
@@ -3937,6 +3897,21 @@ 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>
|
||||
@@ -3950,22 +3925,46 @@ size_t
|
||||
hash<basic_string<_CharT, _Traits, _Allocator> >::operator()(
|
||||
const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT
|
||||
{
|
||||
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;
|
||||
return __do_string_hash(__val.data(), __val.data() + __val.size());
|
||||
}
|
||||
|
||||
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>;
|
||||
|
||||
|
110
include/support/win32/locale_win32.h
Normal file
110
include/support/win32/locale_win32.h
Normal file
@@ -0,0 +1,110 @@
|
||||
// -*- 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
|
31
include/support/win32/support.h
Normal file
31
include/support/win32/support.h
Normal file
@@ -0,0 +1,31 @@
|
||||
// -*- 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
|
@@ -639,11 +639,6 @@ 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;}
|
||||
|
@@ -725,7 +725,7 @@ template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
|
||||
|
||||
// is_base_of
|
||||
|
||||
#if __has_feature(is_base_of)
|
||||
#ifdef _LIBCP_HAS_IS_BASE_OF
|
||||
|
||||
template <class _Bp, class _Dp>
|
||||
struct _LIBCPP_VISIBLE is_base_of
|
||||
@@ -733,51 +733,7 @@ struct _LIBCPP_VISIBLE is_base_of
|
||||
|
||||
#else // __has_feature(is_base_of)
|
||||
|
||||
// (C) Copyright Rani Sharoni 2003.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// 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>
|
||||
{
|
||||
};
|
||||
#error is_base_of not implemented.
|
||||
|
||||
#endif // __has_feature(is_base_of)
|
||||
|
||||
@@ -3014,11 +2970,15 @@ 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)
|
||||
{
|
||||
@@ -3092,6 +3052,26 @@ 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
|
||||
|
@@ -560,9 +560,9 @@ public:
|
||||
typedef const value_type& reference;
|
||||
typedef typename __pointer_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind<value_type>
|
||||
rebind<const value_type>
|
||||
#else
|
||||
rebind<value_type>::other
|
||||
rebind<const value_type>::other
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
@@ -684,12 +684,14 @@ 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)
|
||||
@@ -701,7 +703,9 @@ 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
|
||||
@@ -788,9 +792,11 @@ 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_);}
|
||||
@@ -986,6 +992,8 @@ 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)
|
||||
@@ -1013,6 +1021,8 @@ 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>
|
||||
@@ -1027,6 +1037,8 @@ 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>&
|
||||
@@ -1037,6 +1049,8 @@ 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
|
||||
|
||||
@@ -1292,6 +1306,7 @@ 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(),
|
||||
@@ -1299,6 +1314,7 @@ 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)
|
||||
@@ -1310,7 +1326,9 @@ 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
|
||||
@@ -1393,9 +1411,11 @@ 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_);}
|
||||
@@ -1582,6 +1602,8 @@ 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)
|
||||
@@ -1609,6 +1631,8 @@ 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>
|
||||
@@ -1623,6 +1647,8 @@ 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>&
|
||||
@@ -1633,6 +1659,8 @@ 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
|
||||
|
||||
|
@@ -365,6 +365,7 @@ 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(),
|
||||
@@ -372,6 +373,7 @@ 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)
|
||||
@@ -383,7 +385,9 @@ 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
|
||||
@@ -437,9 +441,11 @@ 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);}
|
||||
@@ -607,6 +613,8 @@ 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)
|
||||
@@ -634,6 +642,8 @@ 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>
|
||||
@@ -648,6 +658,8 @@ 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>&
|
||||
@@ -658,6 +670,8 @@ 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
|
||||
@@ -763,6 +777,7 @@ 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(),
|
||||
@@ -770,6 +785,7 @@ 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)
|
||||
@@ -781,7 +797,9 @@ 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
|
||||
@@ -833,9 +851,11 @@ 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);}
|
||||
@@ -1004,6 +1024,8 @@ 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)
|
||||
@@ -1031,6 +1053,8 @@ 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>
|
||||
@@ -1046,6 +1070,8 @@ 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>&
|
||||
@@ -1056,6 +1082,8 @@ 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
|
||||
|
@@ -226,9 +226,12 @@ struct _LIBCPP_VISIBLE pair
|
||||
|
||||
template<class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(const pair<_U1, _U2>& __p,
|
||||
typename enable_if<is_constructible<_T1, _U1>::value &&
|
||||
is_constructible<_T2, _U2>::value>::type* = 0)
|
||||
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
|
||||
)
|
||||
: first(__p.first), second(__p.second) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@@ -798,8 +798,10 @@ public:
|
||||
valarray(const valarray& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
valarray(valarray&& __v);
|
||||
valarray(initializer_list<value_type> __il);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
valarray(initializer_list<value_type> __il);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
valarray(const slice_array<value_type>& __sa);
|
||||
valarray(const gslice_array<value_type>& __ga);
|
||||
valarray(const mask_array<value_type>& __ma);
|
||||
@@ -810,13 +812,17 @@ public:
|
||||
valarray& operator=(const valarray& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
valarray& operator=(valarray&& __v);
|
||||
valarray& operator=(initializer_list<value_type>);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
valarray& operator=(initializer_list<value_type>);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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
|
||||
@@ -2706,6 +2712,10 @@ 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),
|
||||
@@ -2732,7 +2742,7 @@ valarray<_Tp>::valarray(initializer_list<value_type> __il)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp>
|
||||
valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
|
||||
@@ -2882,6 +2892,10 @@ 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>&
|
||||
@@ -2893,7 +2907,7 @@ valarray<_Tp>::operator=(initializer_list<value_type> __il)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -2958,6 +2972,21 @@ 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>&> >
|
||||
|
297
include/vector
297
include/vector
@@ -160,7 +160,7 @@ public:
|
||||
|
||||
vector()
|
||||
noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit vector(const allocator_type& = allocator_type());
|
||||
explicit vector(const 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,9 +269,6 @@ 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
|
||||
|
||||
@@ -402,14 +399,14 @@ private:
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const __vector_base& __c, true_type)
|
||||
void __move_assign_alloc(__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(const __vector_base& __c, false_type)
|
||||
void __move_assign_alloc(__vector_base& __c, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
|
||||
@@ -489,32 +486,26 @@ 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)
|
||||
{}
|
||||
_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)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
explicit vector(size_type __n);
|
||||
vector(size_type __n, const_reference __x);
|
||||
vector(size_type __n, const_reference __x, const allocator_type& __a);
|
||||
@@ -532,13 +523,18 @@ 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);
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~vector() {__invalidate_all_iterators();}
|
||||
~vector()
|
||||
{
|
||||
__get_db()->__erase_c(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
vector(const vector& __x);
|
||||
@@ -557,9 +553,11 @@ 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
|
||||
@@ -578,9 +576,11 @@ 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,10 +635,26 @@ public:
|
||||
reference at(size_type __n);
|
||||
const_reference at(size_type __n) const;
|
||||
|
||||
_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 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
|
||||
value_type* data() _NOEXCEPT
|
||||
@@ -681,16 +697,21 @@ 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();}
|
||||
{
|
||||
__base::clear();
|
||||
__invalidate_all_iterators();
|
||||
}
|
||||
|
||||
void resize(size_type __sz);
|
||||
void resize(size_type __sz, const_reference __x);
|
||||
@@ -701,6 +722,15 @@ 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);
|
||||
@@ -728,6 +758,26 @@ 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>
|
||||
@@ -785,7 +835,6 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -794,7 +843,7 @@ template <class _Tp, class _Allocator>
|
||||
typename vector<_Tp, _Allocator>::size_type
|
||||
vector<_Tp, _Allocator>::max_size() const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::min(__alloc_traits::max_size(this->__alloc()), numeric_limits<size_type>::max() / 2); // end() >= begin(), always
|
||||
return _VSTD::min<size_type>(__alloc_traits::max_size(this->__alloc()), numeric_limits<size_type>::max() / 2); // end() >= begin(), always
|
||||
}
|
||||
|
||||
// Precondition: __new_size > capacity()
|
||||
@@ -809,7 +858,7 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
|
||||
const size_type __cap = capacity();
|
||||
if (__cap >= __ms / 2)
|
||||
return __ms;
|
||||
return _VSTD::max(2*__cap, __new_size);
|
||||
return _VSTD::max<size_type>(2*__cap, __new_size);
|
||||
}
|
||||
|
||||
// Default constructs __n objects starting at __end_
|
||||
@@ -921,6 +970,9 @@ 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);
|
||||
@@ -931,6 +983,9 @@ 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);
|
||||
@@ -942,6 +997,9 @@ 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);
|
||||
@@ -955,6 +1013,9 @@ 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);
|
||||
}
|
||||
@@ -966,6 +1027,9 @@ 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);
|
||||
}
|
||||
@@ -975,6 +1039,9 @@ 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)
|
||||
{
|
||||
@@ -989,6 +1056,9 @@ 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)
|
||||
{
|
||||
@@ -1001,6 +1071,9 @@ 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)
|
||||
{
|
||||
@@ -1013,6 +1086,9 @@ 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)
|
||||
{
|
||||
@@ -1029,11 +1105,14 @@ 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>
|
||||
@@ -1041,13 +1120,18 @@ _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;
|
||||
__x.__invalidate_all_iterators();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->swap(this, &__x);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1056,10 +1140,15 @@ 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());
|
||||
@@ -1072,6 +1161,9 @@ _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());
|
||||
@@ -1079,6 +1171,8 @@ 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>&
|
||||
@@ -1116,6 +1210,9 @@ 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
|
||||
@@ -1208,7 +1305,7 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
return iterator(this, __p);
|
||||
#else
|
||||
return iterator(__p);
|
||||
@@ -1220,7 +1317,7 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
typename vector<_Tp, _Allocator>::const_iterator
|
||||
vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
return const_iterator(this, __p);
|
||||
#else
|
||||
return const_iterator(__p);
|
||||
@@ -1264,9 +1361,7 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
typename vector<_Tp, _Allocator>::reference
|
||||
vector<_Tp, _Allocator>::operator[](size_type __n)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__n < size());
|
||||
#endif
|
||||
_LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");
|
||||
return this->__begin_[__n];
|
||||
}
|
||||
|
||||
@@ -1275,9 +1370,7 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
typename vector<_Tp, _Allocator>::const_reference
|
||||
vector<_Tp, _Allocator>::operator[](size_type __n) const
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__n < size());
|
||||
#endif
|
||||
_LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");
|
||||
return this->__begin_[__n];
|
||||
}
|
||||
|
||||
@@ -1405,6 +1498,7 @@ _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);
|
||||
}
|
||||
|
||||
@@ -1413,6 +1507,11 @@ _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));
|
||||
@@ -1423,6 +1522,12 @@ 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));
|
||||
@@ -1446,6 +1551,11 @@ 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())
|
||||
{
|
||||
@@ -1480,6 +1590,11 @@ 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())
|
||||
{
|
||||
@@ -1513,6 +1628,11 @@ 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())
|
||||
{
|
||||
@@ -1546,6 +1666,11 @@ 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)
|
||||
{
|
||||
@@ -1589,6 +1714,11 @@ 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();
|
||||
@@ -1622,8 +1752,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), move_iterator<iterator>(__v.begin()),
|
||||
move_iterator<iterator>(__v.end()));
|
||||
insert(__make_iter(__p), make_move_iterator(__v.begin()),
|
||||
make_move_iterator(__v.end()));
|
||||
return begin() + __off;
|
||||
}
|
||||
|
||||
@@ -1636,6 +1766,11 @@ 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)
|
||||
@@ -1698,14 +1833,17 @@ 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());
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
iterator::swap(this, &__x);
|
||||
const_iterator::swap(this, &__x);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->swap(this, &__x);
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -1729,17 +1867,48 @@ 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()
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
iterator::__remove_all(this);
|
||||
const_iterator::__remove_all(this);
|
||||
#endif // _LIBCPP_DEBUG
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__invalidate_all(this);
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
}
|
||||
|
||||
// vector<bool>
|
||||
@@ -1854,8 +2023,10 @@ 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
|
||||
@@ -1868,9 +2039,11 @@ 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
|
||||
@@ -1889,9 +2062,11 @@ 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());}
|
||||
@@ -1979,9 +2154,11 @@ 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);
|
||||
@@ -2067,14 +2244,14 @@ private:
|
||||
{__move_assign_alloc(__c, integral_constant<bool,
|
||||
__storage_traits::propagate_on_container_move_assignment::value>());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const vector& __c, true_type)
|
||||
void __move_assign_alloc(vector& __c, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||
{
|
||||
__alloc() = _VSTD::move(__c.__alloc());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const vector& __c, false_type)
|
||||
void __move_assign_alloc(vector& __c, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
|
||||
@@ -2351,6 +2528,8 @@ 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),
|
||||
@@ -2379,6 +2558,8 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const alloca
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Allocator>
|
||||
vector<bool, _Allocator>::~vector()
|
||||
{
|
||||
|
@@ -1,9 +1,17 @@
|
||||
# Get sources
|
||||
file(GLOB_RECURSE sources ../src/*.cpp)
|
||||
file(GLOB sources ../src/*.cpp)
|
||||
if(WIN32)
|
||||
file(GLOB win32_sources ../src/support/win32/*.cpp)
|
||||
list(APPEND sources ${win32_sources})
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
|
26
lib/buildit
26
lib/buildit
@@ -26,7 +26,7 @@ if [ -z $MACOSX_DEPLOYMENT_TARGET ]
|
||||
then
|
||||
if [ -z $IPHONEOS_DEPLOYMENT_TARGET ]
|
||||
then
|
||||
MACOSX_DEPLOYMENT_TARGET=10.6
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
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,14 +70,23 @@ 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_not_weak_list,notweak.exp \
|
||||
-Wl,-force_symbols_weak_list,weak.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
|
||||
@@ -97,8 +106,13 @@ 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
|
||||
|
16
lib/weak.exp
Normal file
16
lib/weak.exp
Normal file
@@ -0,0 +1,16 @@
|
||||
__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
|
484
src/debug.cpp
Normal file
484
src/debug.cpp
Normal file
@@ -0,0 +1,484 @@
|
||||
//===-------------------------- 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
|
@@ -13,16 +13,24 @@
|
||||
#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
|
||||
{
|
||||
@@ -56,6 +64,7 @@ std::get_terminate() _NOEXCEPT
|
||||
return __sync_fetch_and_add(&__terminate_handler, (std::terminate_handler)0);
|
||||
}
|
||||
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
std::terminate() _NOEXCEPT
|
||||
{
|
||||
@@ -75,18 +84,19 @@ 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__
|
||||
}
|
||||
|
||||
@@ -113,8 +123,8 @@ const char* bad_exception::what() const _NOEXCEPT
|
||||
|
||||
exception_ptr::~exception_ptr() _NOEXCEPT
|
||||
{
|
||||
#if __APPLE__
|
||||
__cxxabiapple::__cxa_decrement_exception_refcount(__ptr_);
|
||||
#if HAVE_DEPENDENT_EH_ABI
|
||||
__cxa_decrement_exception_refcount(__ptr_);
|
||||
#else
|
||||
#warning exception_ptr not yet implemented
|
||||
::abort();
|
||||
@@ -124,8 +134,8 @@ exception_ptr::~exception_ptr() _NOEXCEPT
|
||||
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
|
||||
: __ptr_(other.__ptr_)
|
||||
{
|
||||
#if __APPLE__
|
||||
__cxxabiapple::__cxa_increment_exception_refcount(__ptr_);
|
||||
#if HAVE_DEPENDENT_EH_ABI
|
||||
__cxa_increment_exception_refcount(__ptr_);
|
||||
#else
|
||||
#warning exception_ptr not yet implemented
|
||||
::abort();
|
||||
@@ -134,11 +144,11 @@ exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
|
||||
|
||||
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
|
||||
{
|
||||
#if __APPLE__
|
||||
#if HAVE_DEPENDENT_EH_ABI
|
||||
if (__ptr_ != other.__ptr_)
|
||||
{
|
||||
__cxxabiapple::__cxa_increment_exception_refcount(other.__ptr_);
|
||||
__cxxabiapple::__cxa_decrement_exception_refcount(__ptr_);
|
||||
__cxa_increment_exception_refcount(other.__ptr_);
|
||||
__cxa_decrement_exception_refcount(__ptr_);
|
||||
__ptr_ = other.__ptr_;
|
||||
}
|
||||
return *this;
|
||||
@@ -170,12 +180,12 @@ nested_exception::rethrow_nested() const
|
||||
|
||||
std::exception_ptr std::current_exception() _NOEXCEPT
|
||||
{
|
||||
#if __APPLE__
|
||||
#if HAVE_DEPENDENT_EH_ABI
|
||||
// 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_ = __cxxabiapple::__cxa_current_primary_exception();
|
||||
ptr.__ptr_ = __cxa_current_primary_exception();
|
||||
return ptr;
|
||||
#else // __APPLE__
|
||||
#warning exception_ptr not yet implemented
|
||||
@@ -185,8 +195,8 @@ std::exception_ptr std::current_exception() _NOEXCEPT
|
||||
|
||||
void std::rethrow_exception(exception_ptr p)
|
||||
{
|
||||
#if __APPLE__
|
||||
__cxxabiapple::__cxa_rethrow_primary_exception(p.__ptr_);
|
||||
#if HAVE_DEPENDENT_EH_ABI
|
||||
__cxa_rethrow_primary_exception(p.__ptr_);
|
||||
// if p.__ptr_ is NULL, above returns so we terminate
|
||||
terminate();
|
||||
#else // __APPLE__
|
||||
|
446
src/locale.cpp
446
src/locale.cpp
@@ -19,116 +19,24 @@
|
||||
#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
|
||||
|
||||
#ifndef _LIBCPP_APPLE_STABLE_ABI
|
||||
#ifdef __cloc_defined
|
||||
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 // _LIBCPP_APPLE_STABLE_ABI
|
||||
#endif // __cloc_defined
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -814,10 +722,12 @@ 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
|
||||
{
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
|
||||
#elif defined(__GLIBC__)
|
||||
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
|
||||
#else
|
||||
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
|
||||
return (isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -825,11 +735,13 @@ const wchar_t*
|
||||
ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
|
||||
{
|
||||
for (; low != high; ++low)
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
|
||||
#elif defined(__GLIBC__)
|
||||
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
|
||||
: *low;
|
||||
#else
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
|
||||
*low = (isascii(*low) && islower_l(*low, __cloc())) ? (*low-L'a'+L'A') : *low;
|
||||
#endif
|
||||
return low;
|
||||
}
|
||||
@@ -837,10 +749,12 @@ ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
|
||||
wchar_t
|
||||
ctype<wchar_t>::do_tolower(char_type c) const
|
||||
{
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
|
||||
#elif defined(__GLIBC__)
|
||||
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
|
||||
#else
|
||||
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
|
||||
return (isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -848,11 +762,13 @@ const wchar_t*
|
||||
ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
|
||||
{
|
||||
for (; low != high; ++low)
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
|
||||
#elif defined(__GLIBC__)
|
||||
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
|
||||
: *low;
|
||||
#else
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
|
||||
*low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-L'A'+L'a' : *low;
|
||||
#endif
|
||||
return low;
|
||||
}
|
||||
@@ -912,10 +828,12 @@ ctype<char>::~ctype()
|
||||
char
|
||||
ctype<char>::do_toupper(char_type c) const
|
||||
{
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
|
||||
#elif defined(__GLIBC__)
|
||||
return isascii(c) ? __classic_upper_table()[c] : c;
|
||||
#else
|
||||
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
|
||||
return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -923,10 +841,12 @@ const char*
|
||||
ctype<char>::do_toupper(char_type* low, const char_type* high) const
|
||||
{
|
||||
for (; low != high; ++low)
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
|
||||
#elif defined(__GLIBC__)
|
||||
*low = isascii(*low) ? __classic_upper_table()[*low] : *low;
|
||||
#else
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
|
||||
*low = (isascii(*low) && islower_l(*low, __cloc())) ? *low-'a'+'A' : *low;
|
||||
#endif
|
||||
return low;
|
||||
}
|
||||
@@ -934,10 +854,12 @@ ctype<char>::do_toupper(char_type* low, const char_type* high) const
|
||||
char
|
||||
ctype<char>::do_tolower(char_type c) const
|
||||
{
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
|
||||
#elif defined(__GLIBC__)
|
||||
return isascii(c) ? __classic_lower_table()[c] : c;
|
||||
#else
|
||||
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
|
||||
return (isascii(c) && isupper_l(c, __cloc())) ? c-'A'+'a' : c;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -945,10 +867,12 @@ const char*
|
||||
ctype<char>::do_tolower(char_type* low, const char_type* high) const
|
||||
{
|
||||
for (; low != high; ++low)
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
|
||||
#elif defined(__GLIBC__)
|
||||
*low = isascii(*low) ? __classic_lower_table()[*low] : *low;
|
||||
#else
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
|
||||
*low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low;
|
||||
#endif
|
||||
return low;
|
||||
}
|
||||
@@ -989,41 +913,32 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
|
||||
const ctype<char>::mask*
|
||||
ctype<char>::classic_table() _NOEXCEPT
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
return _DefaultRuneLocale.__runetype;
|
||||
#elif defined(__GLIBC__)
|
||||
return __cloc()->__ctype_b;
|
||||
// This is assumed to be safe.
|
||||
#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...
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
#if defined(__GLIBC__)
|
||||
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 // _LIBCPP_APPLE_STABLE_ABI
|
||||
#endif // __GLIBC__
|
||||
|
||||
// template <> class ctype_byname<char>
|
||||
|
||||
@@ -1117,17 +1032,18 @@ 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
|
||||
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;
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1245,21 +1161,33 @@ ctype_byname<wchar_t>::do_tolower(char_type* low, const char_type* high) const
|
||||
wchar_t
|
||||
ctype_byname<wchar_t>::do_widen(char c) const
|
||||
{
|
||||
return with_locale::btowc_l(c, __l);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return btowc_l(c, __l);
|
||||
#else
|
||||
return __btowc_l(c, __l);
|
||||
#endif
|
||||
}
|
||||
|
||||
const char*
|
||||
ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const
|
||||
{
|
||||
for (; low != high; ++low, ++dest)
|
||||
*dest = with_locale::btowc_l(*low, __l);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
*dest = btowc_l(*low, __l);
|
||||
#else
|
||||
*dest = __btowc_l(*low, __l);
|
||||
#endif
|
||||
return low;
|
||||
}
|
||||
|
||||
char
|
||||
ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const
|
||||
{
|
||||
int r = with_locale::wctob_l(c, __l);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int r = wctob_l(c, __l);
|
||||
#else
|
||||
int r = __wctob_l(c, __l);
|
||||
#endif
|
||||
return r != WEOF ? static_cast<char>(r) : dfault;
|
||||
}
|
||||
|
||||
@@ -1268,7 +1196,11 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch
|
||||
{
|
||||
for (; low != high; ++low, ++dest)
|
||||
{
|
||||
int r = with_locale::wctob_l(*low, __l);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int r = wctob_l(*low, __l);
|
||||
#else
|
||||
int r = __wctob_l(*low, __l);
|
||||
#endif
|
||||
*dest = r != WEOF ? static_cast<char>(r) : dfault;
|
||||
}
|
||||
return low;
|
||||
@@ -1378,13 +1310,21 @@ 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;
|
||||
size_t n = with_locale::wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
|
||||
#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
|
||||
if (n == size_t(-1))
|
||||
{
|
||||
// need to recover to_nxt
|
||||
for (to_nxt = to; frm != frm_nxt; ++frm)
|
||||
{
|
||||
n = with_locale::wcrtomb_l(to_nxt, *frm, &save_state, __l);
|
||||
#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
|
||||
if (n == size_t(-1))
|
||||
break;
|
||||
to_nxt += n;
|
||||
@@ -1401,7 +1341,11 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
|
||||
{
|
||||
// Try to write the terminating null
|
||||
extern_type tmp[MB_LEN_MAX];
|
||||
n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
n = wcrtomb_l(tmp, intern_type(), &st, __l);
|
||||
#else
|
||||
n = __wcrtomb_l(tmp, intern_type(), &st, __l);
|
||||
#endif
|
||||
if (n == size_t(-1)) // on error
|
||||
return error;
|
||||
if (n > to_end-to_nxt) // is there room?
|
||||
@@ -1434,13 +1378,21 @@ 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;
|
||||
size_t n = with_locale::mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
|
||||
#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
|
||||
if (n == size_t(-1))
|
||||
{
|
||||
// need to recover to_nxt
|
||||
for (to_nxt = to; frm != frm_nxt; ++to_nxt)
|
||||
{
|
||||
n = with_locale::mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
|
||||
#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
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
@@ -1468,7 +1420,11 @@ 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
|
||||
n = with_locale::mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
|
||||
#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
|
||||
if (n != 0) // on error
|
||||
return error;
|
||||
++to_nxt;
|
||||
@@ -1488,7 +1444,11 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
|
||||
{
|
||||
to_nxt = to;
|
||||
extern_type tmp[MB_LEN_MAX];
|
||||
size_t n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l);
|
||||
#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
|
||||
if (n == size_t(-1) || n == 0) // on error
|
||||
return error;
|
||||
--n;
|
||||
@@ -1502,10 +1462,18 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
|
||||
int
|
||||
codecvt<wchar_t, char, mbstate_t>::do_encoding() const _NOEXCEPT
|
||||
{
|
||||
if (with_locale::mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
|
||||
#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
|
||||
{
|
||||
// stateless encoding
|
||||
if (__l == 0 || with_locale::mb_cur_max_l(__l) == 1) // there are no known constant length encodings
|
||||
#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
|
||||
return 1; // which take more than 1 char to form a wchar_t
|
||||
return 0;
|
||||
}
|
||||
@@ -1525,7 +1493,11 @@ 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)
|
||||
{
|
||||
size_t n = with_locale::mbrlen_l(frm, frm_end-frm, &st, __l);
|
||||
#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
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
@@ -1547,7 +1519,11 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
|
||||
int
|
||||
codecvt<wchar_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
|
||||
{
|
||||
return __l == 0 ? 1 : with_locale::mb_cur_max_l(__l);
|
||||
#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
|
||||
}
|
||||
|
||||
// Valid UTF ranges
|
||||
@@ -4090,13 +4066,17 @@ 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
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->decimal_point)
|
||||
__decimal_point_ = *lc->decimal_point;
|
||||
if (*lc->thousands_sep)
|
||||
@@ -4129,13 +4109,17 @@ 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
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->decimal_point)
|
||||
__decimal_point_ = *lc->decimal_point;
|
||||
if (*lc->thousands_sep)
|
||||
@@ -4726,7 +4710,11 @@ __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;
|
||||
size_t i = with_locale::mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#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
|
||||
if (i == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wchar_t* wbe = wbb + i;
|
||||
@@ -4907,7 +4895,11 @@ __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;
|
||||
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -4915,7 +4907,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
be = strftime_l(buf, 100, "%a", &t, __loc_);
|
||||
mb = mbstate_t();
|
||||
bb = buf;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -4928,7 +4924,11 @@ __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;
|
||||
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -4936,7 +4936,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
be = strftime_l(buf, 100, "%b", &t, __loc_);
|
||||
mb = mbstate_t();
|
||||
bb = buf;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -4947,7 +4951,11 @@ __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;
|
||||
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -4956,7 +4964,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
be = strftime_l(buf, 100, "%p", &t, __loc_);
|
||||
mb = mbstate_t();
|
||||
bb = buf;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -5231,7 +5243,11 @@ __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;
|
||||
size_t j = with_locale::mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
__we = __wb + j;
|
||||
@@ -5480,13 +5496,17 @@ 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
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->mon_decimal_point)
|
||||
__decimal_point_ = *lc->mon_decimal_point;
|
||||
else
|
||||
@@ -5518,13 +5538,17 @@ 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
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->mon_decimal_point)
|
||||
__decimal_point_ = *lc->mon_decimal_point;
|
||||
else
|
||||
@@ -5539,16 +5563,29 @@ 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<>
|
||||
@@ -5556,13 +5593,17 @@ 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
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->mon_decimal_point)
|
||||
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
|
||||
else
|
||||
@@ -5575,7 +5616,11 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
|
||||
wchar_t wbuf[100];
|
||||
mbstate_t mb = {0};
|
||||
const char* bb = lc->currency_symbol;
|
||||
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wchar_t* wbe = wbuf + j;
|
||||
@@ -5590,7 +5635,11 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
|
||||
{
|
||||
mb = mbstate_t();
|
||||
bb = lc->positive_sign;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -5602,7 +5651,11 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
|
||||
{
|
||||
mb = mbstate_t();
|
||||
bb = lc->negative_sign;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
@@ -5617,13 +5670,17 @@ 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
|
||||
lconv* lc = with_locale::localeconv_l(loc.get());
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
lconv* lc = localeconv_l(loc.get());
|
||||
#else
|
||||
lconv* lc = __localeconv_l(loc.get());
|
||||
#endif
|
||||
if (*lc->mon_decimal_point)
|
||||
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
|
||||
else
|
||||
@@ -5636,7 +5693,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
|
||||
wchar_t wbuf[100];
|
||||
mbstate_t mb = {0};
|
||||
const char* bb = lc->int_curr_symbol;
|
||||
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#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
|
||||
if (j == -1)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wchar_t* wbe = wbuf + j;
|
||||
@@ -5645,32 +5706,53 @@ 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;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#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
|
||||
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;
|
||||
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
|
||||
#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
|
||||
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*) {}
|
||||
|
@@ -11,6 +11,9 @@
|
||||
#include "cstdlib"
|
||||
#include "cwchar"
|
||||
#include "cerrno"
|
||||
#if _WIN32
|
||||
#include "support/win32/support.h"
|
||||
#endif // _WIN32
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
94
src/support/win32/locale_win32.cpp
Normal file
94
src/support/win32/locale_win32.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
// -*- 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 );
|
||||
}
|
70
src/support/win32/support.cpp
Normal file
70
src/support/win32/support.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
// -*- 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;
|
||||
}
|
@@ -12,7 +12,9 @@
|
||||
#include "vector"
|
||||
#include "future"
|
||||
#include <sys/types.h>
|
||||
#if !_WIN32
|
||||
#include <sys/sysctl.h>
|
||||
#endif // _WIN32
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,12 +18,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -19,12 +19,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,12 +16,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
{
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
{
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
{
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
{
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
{
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -58,6 +58,8 @@ 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};
|
||||
@@ -70,6 +72,7 @@ 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};
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,12 +16,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,12 +16,12 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
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_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
}
|
||||
|
@@ -58,6 +58,8 @@ 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};
|
||||
@@ -70,6 +72,7 @@ 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
Reference in New Issue
Block a user