Import libc++ r208870. Improves const use, fixes a few cases of missing

assign-to-self support and increase support for GCC.
This commit is contained in:
joerg 2014-05-15 23:53:10 +00:00
parent 8f7d248eb8
commit e6132fe847
341 changed files with 5455 additions and 926 deletions

View File

@ -174,7 +174,7 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
if (__n == __dn)
return _It(__first.__seg_, __first.__ctz_ + __n);
return __first + __n;
__n -= __dn;
++__first.__seg_;
}
@ -210,7 +210,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
if (__n == __dn)
return _It(__first.__seg_, __first.__ctz_ + __n);
return __first + __n;
__n -= __dn;
++__first.__seg_;
}

View File

@ -203,6 +203,11 @@
#if defined(__clang__)
#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
!defined(__arm__)
#define _LIBCPP_ALTERNATE_STRING_LAYOUT
#endif
#if __has_feature(cxx_alignas)
# define _ALIGNAS_TYPE(x) alignas(x)
# define _ALIGNAS(x) alignas(x)
@ -215,7 +220,7 @@
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#if __cplusplus < 201103L
#ifdef __linux__
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#else
@ -347,6 +352,10 @@ namespace std {
}
}
#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
#define _LIBCPP_HAS_NO_ASAN
#endif
#elif defined(__GNUC__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
@ -421,6 +430,10 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}
#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
#define _LIBCPP_HAS_NO_ASAN
#endif
#elif defined(_LIBCPP_MSVC)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@ -434,7 +447,7 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS
#define _NOEXCEPT throw()
#define _NOEXCEPT throw ()
#define _NOEXCEPT_(x)
#define _NOEXCEPT_OR_FALSE(x) false
@ -446,6 +459,8 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
namespace std {
}
#define _LIBCPP_HAS_NO_ASAN
#elif defined(__IBMCPP__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
@ -478,6 +493,8 @@ namespace std {
}
}
#define _LIBCPP_HAS_NO_ASAN
#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
@ -485,6 +502,10 @@ typedef unsigned short char16_t;
typedef unsigned int char32_t;
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef __SIZEOF_INT128__
#define _LIBCPP_HAS_NO_INT128
#endif
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
template <bool> struct __static_assert_test;
@ -560,6 +581,10 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
#endif
#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
@ -604,6 +629,11 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
#endif
#ifndef _LIBCPP_HAS_NO_ASAN
extern "C" void __sanitizer_annotate_contiguous_container(
const void *, const void *, const void *, const void *);
#endif
// Try to find out if RTTI is disabled.
// g++ and cl.exe have RTTI on by default and define a macro when it is.
// g++ only defines the macro in 4.3.2 and onwards.

View File

@ -33,28 +33,28 @@ public:
// invoke
typename __invoke_return<type>::type
operator() ()
operator() () const
{
return __invoke(__f_);
}
template <class _A0>
typename __invoke_return0<type, _A0>::type
operator() (_A0& __a0)
operator() (_A0& __a0) const
{
return __invoke(__f_, __a0);
}
template <class _A0, class _A1>
typename __invoke_return1<type, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1)
operator() (_A0& __a0, _A1& __a1) const
{
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1, class _A2>
typename __invoke_return2<type, _A0, _A1, _A2>::type
operator() (_A0& __a0, _A1& __a1, _A2& __a2)
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
{
return __invoke(__f_, __a0, __a1, __a2);
}

View File

@ -21,7 +21,7 @@
#include <locale.h>
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
# include <support/win32/locale_win32.h>
#elif _AIX
#elif defined(_AIX)
# include <support/ibm/xlocale.h>
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)
# include <xlocale.h>

View File

@ -282,7 +282,7 @@ public:
void notify_one() _NOEXCEPT;
void notify_all() _NOEXCEPT;
void wait(unique_lock<mutex>& __lk);
void wait(unique_lock<mutex>& __lk) _NOEXCEPT;
template <class _Predicate>
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
@ -313,7 +313,7 @@ public:
private:
void __do_timed_wait(unique_lock<mutex>& __lk,
chrono::time_point<chrono::system_clock, chrono::nanoseconds>);
chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
};
template <class _To, class _Rep, class _Period>

View File

@ -0,0 +1,139 @@
//===------------------------ __refstring ---------------------------------===//
//
// 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___REFSTRING
#define _LIBCPP___REFSTRING
#include <__config>
#include <cstddef>
#include <cstring>
#if __APPLE__
#include <dlfcn.h>
#include <mach-o/dyld.h>
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_HIDDEN __libcpp_refstring
{
private:
const char* str_;
typedef int count_t;
struct _Rep_base
{
std::size_t len;
std::size_t cap;
count_t count;
};
static
_Rep_base*
rep_from_data(const char *data_) _NOEXCEPT
{
char *data = const_cast<char *>(data_);
return reinterpret_cast<_Rep_base *>(data - sizeof(_Rep_base));
}
static
char *
data_from_rep(_Rep_base *rep) _NOEXCEPT
{
char *data = reinterpret_cast<char *>(rep);
return data + sizeof(*rep);
}
#if __APPLE__
static
const char*
compute_gcc_empty_string_storage() _NOEXCEPT
{
void* handle = dlopen("/usr/lib/libstdc++.6.dylib", RTLD_NOLOAD);
if (handle == nullptr)
return nullptr;
void* sym = dlsym(handle, "_ZNSs4_Rep20_S_empty_rep_storageE");
if (sym == nullptr)
return nullptr;
return data_from_rep(reinterpret_cast<_Rep_base *>(sym));
}
static
const char*
get_gcc_empty_string_storage() _NOEXCEPT
{
static const char* p = compute_gcc_empty_string_storage();
return p;
}
bool
uses_refcount() const
{
return str_ != get_gcc_empty_string_storage();
}
#else
bool
uses_refcount() const
{
return true;
}
#endif
public:
explicit __libcpp_refstring(const char* msg) {
std::size_t len = strlen(msg);
_Rep_base* rep = static_cast<_Rep_base *>(::operator new(sizeof(*rep) + len + 1));
rep->len = len;
rep->cap = len;
rep->count = 0;
char *data = data_from_rep(rep);
std::memcpy(data, msg, len + 1);
str_ = data;
}
__libcpp_refstring(const __libcpp_refstring& s) _NOEXCEPT : str_(s.str_)
{
if (uses_refcount())
__sync_add_and_fetch(&rep_from_data(str_)->count, 1);
}
__libcpp_refstring& operator=(const __libcpp_refstring& s) _NOEXCEPT
{
bool adjust_old_count = uses_refcount();
struct _Rep_base *old_rep = rep_from_data(str_);
str_ = s.str_;
if (uses_refcount())
__sync_add_and_fetch(&rep_from_data(str_)->count, 1);
if (adjust_old_count)
{
if (__sync_add_and_fetch(&old_rep->count, count_t(-1)) < 0)
{
::operator delete(old_rep);
}
}
return *this;
}
~__libcpp_refstring()
{
if (uses_refcount())
{
_Rep_base* rep = rep_from_data(str_);
if (__sync_add_and_fetch(&rep->count, count_t(-1)) < 0)
{
::operator delete(rep);
}
}
}
const char* c_str() const _NOEXCEPT {return str_;}
};
_LIBCPP_END_NAMESPACE_STD
#endif //_LIBCPP___REFSTRING

View File

@ -1980,9 +1980,9 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
__begin_node() = __r.__ptr_;
--size();
__node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
__tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np));
__node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
__node_traits::deallocate(__na, __np, 1);
return __r;
}

View File

@ -281,11 +281,12 @@ template <class ForwardIterator, class OutputIterator>
template <class RandomAccessIterator>
void
random_shuffle(RandomAccessIterator first, RandomAccessIterator last);
random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14
template <class RandomAccessIterator, class RandomNumberGenerator>
void
random_shuffle(RandomAccessIterator first, RandomAccessIterator last, RandomNumberGenerator& rand);
random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
RandomNumberGenerator& rand); // deprecated in C++14
template<class RandomAccessIterator, class UniformRandomNumberGenerator>
void shuffle(RandomAccessIterator first, RandomAccessIterator last,
@ -528,19 +529,19 @@ template <class ForwardIterator, class Compare>
template <class T>
const T&
min(const T& a, const T& b);
min(const T& a, const T& b); // constexpr in C++14
template <class T, class Compare>
const T&
min(const T& a, const T& b, Compare comp);
min(const T& a, const T& b, Compare comp); // constexpr in C++14
template<class T>
T
min(initializer_list<T> t);
min(initializer_list<T> t); // constexpr in C++14
template<class T, class Compare>
T
min(initializer_list<T> t, Compare comp);
min(initializer_list<T> t, Compare comp); // constexpr in C++14
template <class ForwardIterator>
ForwardIterator
@ -552,19 +553,19 @@ template <class ForwardIterator, class Compare>
template <class T>
const T&
max(const T& a, const T& b);
max(const T& a, const T& b); // constexpr in C++14
template <class T, class Compare>
const T&
max(const T& a, const T& b, Compare comp);
max(const T& a, const T& b, Compare comp); // constexpr in C++14
template<class T>
T
max(initializer_list<T> t);
max(initializer_list<T> t); // constexpr in C++14
template<class T, class Compare>
T
max(initializer_list<T> t, Compare comp);
max(initializer_list<T> t, Compare comp); // constexpr in C++14
template<class ForwardIterator>
pair<ForwardIterator, ForwardIterator>
@ -576,19 +577,19 @@ template<class ForwardIterator, class Compare>
template<class T>
pair<const T&, const T&>
minmax(const T& a, const T& b);
minmax(const T& a, const T& b); // constexpr in C++14
template<class T, class Compare>
pair<const T&, const T&>
minmax(const T& a, const T& b, Compare comp);
minmax(const T& a, const T& b, Compare comp); // constexpr in C++14
template<class T>
pair<T, T>
minmax(initializer_list<T> t);
minmax(initializer_list<T> t); // constexpr in C++14
template<class T, class Compare>
pair<T, T>
minmax(initializer_list<T> t, Compare comp);
minmax(initializer_list<T> t, Compare comp); // constexpr in C++14
template <class InputIterator1, class InputIterator2>
bool
@ -643,6 +644,9 @@ template <class BidirectionalIterator, class Compare>
_LIBCPP_BEGIN_NAMESPACE_STD
// I'd like to replace these with _VSTD::equal_to<void>, but can't because:
// * That only works with C++14 and later, and
// * We haven't included <functional> here.
template <class _T1, class _T2 = _T1>
struct __equal_to
{
@ -655,46 +659,59 @@ struct __equal_to
template <class _T1>
struct __equal_to<_T1, _T1>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
};
template <class _T1>
struct __equal_to<const _T1, _T1>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
};
template <class _T1>
struct __equal_to<_T1, const _T1>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
};
template <class _T1, class _T2 = _T1>
struct __less
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
_LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T2& __y) const {return __x < __y;}
_LIBCPP_INLINE_VISIBILITY bool operator()(const _T2& __x, const _T1& __y) const {return __x < __y;}
_LIBCPP_INLINE_VISIBILITY bool operator()(const _T2& __x, const _T2& __y) const {return __x < __y;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _T1& __x, const _T2& __y) const {return __x < __y;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _T2& __x, const _T1& __y) const {return __x < __y;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _T2& __x, const _T2& __y) const {return __x < __y;}
};
template <class _T1>
struct __less<_T1, _T1>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
};
template <class _T1>
struct __less<const _T1, _T1>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
};
template <class _T1>
struct __less<_T1, const _T1>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
};
template <class _Predicate>
@ -2505,9 +2522,9 @@ rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterato
// min_element
template <class _ForwardIterator, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_ForwardIterator
min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
__min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
{
if (__first != __last)
{
@ -2519,19 +2536,27 @@ min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
return __first;
}
template <class _ForwardIterator, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
{
return __min_element(__first, __last, __comp);
}
template <class _ForwardIterator>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
min_element(_ForwardIterator __first, _ForwardIterator __last)
{
return _VSTD::min_element(__first, __last,
return __min_element(__first, __last,
__less<typename iterator_traits<_ForwardIterator>::value_type>());
}
// min
template <class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _Tp&
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
@ -2539,7 +2564,7 @@ min(const _Tp& __a, const _Tp& __b, _Compare __comp)
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _Tp&
min(const _Tp& __a, const _Tp& __b)
{
@ -2549,19 +2574,19 @@ min(const _Tp& __a, const _Tp& __b)
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp
min(initializer_list<_Tp> __t, _Compare __comp)
{
return *_VSTD::min_element(__t.begin(), __t.end(), __comp);
return *__min_element(__t.begin(), __t.end(), __comp);
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp
min(initializer_list<_Tp> __t)
{
return *_VSTD::min_element(__t.begin(), __t.end());
return *__min_element(__t.begin(), __t.end(), __less<_Tp>());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@ -2569,9 +2594,9 @@ min(initializer_list<_Tp> __t)
// max_element
template <class _ForwardIterator, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_ForwardIterator
max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
__max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
{
if (__first != __last)
{
@ -2583,19 +2608,28 @@ max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
return __first;
}
template <class _ForwardIterator, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
{
return __max_element(__first, __last, __comp);
}
template <class _ForwardIterator>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
max_element(_ForwardIterator __first, _ForwardIterator __last)
{
return _VSTD::max_element(__first, __last,
return __max_element(__first, __last,
__less<typename iterator_traits<_ForwardIterator>::value_type>());
}
// max
template <class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _Tp&
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
@ -2603,7 +2637,7 @@ max(const _Tp& __a, const _Tp& __b, _Compare __comp)
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _Tp&
max(const _Tp& __a, const _Tp& __b)
{
@ -2613,19 +2647,19 @@ max(const _Tp& __a, const _Tp& __b)
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp
max(initializer_list<_Tp> __t, _Compare __comp)
{
return *_VSTD::max_element(__t.begin(), __t.end(), __comp);
return *__max_element(__t.begin(), __t.end(), __comp);
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp
max(initializer_list<_Tp> __t)
{
return *_VSTD::max_element(__t.begin(), __t.end());
return *__max_element(__t.begin(), __t.end(), __less<_Tp>());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@ -2684,13 +2718,14 @@ inline _LIBCPP_INLINE_VISIBILITY
std::pair<_ForwardIterator, _ForwardIterator>
minmax_element(_ForwardIterator __first, _ForwardIterator __last)
{
return _VSTD::minmax_element(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
return _VSTD::minmax_element(__first, __last,
__less<typename iterator_traits<_ForwardIterator>::value_type>());
}
// minmax
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
pair<const _Tp&, const _Tp&>
minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
@ -2699,7 +2734,7 @@ minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
pair<const _Tp&, const _Tp&>
minmax(const _Tp& __a, const _Tp& __b)
{
@ -2708,24 +2743,49 @@ minmax(const _Tp& __a, const _Tp& __b)
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
pair<_Tp, _Tp>
minmax(initializer_list<_Tp> __t)
{
pair<const _Tp*, const _Tp*> __p =
_VSTD::minmax_element(__t.begin(), __t.end());
return pair<_Tp, _Tp>(*__p.first, *__p.second);
}
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
pair<_Tp, _Tp>
minmax(initializer_list<_Tp> __t, _Compare __comp)
{
pair<const _Tp*, const _Tp*> __p =
_VSTD::minmax_element(__t.begin(), __t.end(), __comp);
return pair<_Tp, _Tp>(*__p.first, *__p.second);
typedef typename initializer_list<_Tp>::const_iterator _Iter;
_Iter __first = __t.begin();
_Iter __last = __t.end();
std::pair<_Tp, _Tp> __result ( *__first, *__first );
++__first;
if (__t.size() % 2 == 0)
{
if (__comp(*__first, __result.first))
__result.first = *__first;
else
__result.second = *__first;
++__first;
}
while (__first != __last)
{
_Tp __prev = *__first++;
if (__comp(__prev, *__first)) {
if (__comp(__prev, __result.first)) __result.first = __prev;
if (__comp(__result.second, *__first)) __result.second = *__first;
}
else {
if (__comp(*__first, __result.first)) __result.first = *__first;
if (__comp(__result.second, __prev)) __result.second = __prev;
}
__first++;
}
return __result;
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
pair<_Tp, _Tp>
minmax(initializer_list<_Tp> __t)
{
return _VSTD::minmax(__t, __less<_Tp>());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS

View File

@ -1208,11 +1208,7 @@ fdim(_A1 __x, _A2 __y) _NOEXCEPT
// fma
inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) _NOEXCEPT {return (float)((double)__x*__y + __z);}
#ifndef FP_FAST_FMAF
#define FP_FAST_FMAF
#endif
using ::fmaf;
using ::fma;
inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) _NOEXCEPT {return fmaf(__x, __y, __z);}

View File

@ -52,7 +52,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::ptrdiff_t;
using ::size_t;
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
// Re-use the compiler's <stddef.h> max_align_t where possible.
using ::max_align_t;
#else
typedef long double max_align_t;
#endif
#ifdef _LIBCPP_HAS_NO_NULLPTR

View File

@ -1208,7 +1208,7 @@ public:
deque()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
{}
_LIBCPP_INLINE_VISIBILITY deque(const allocator_type& __a) : __base(__a) {}
_LIBCPP_INLINE_VISIBILITY explicit deque(const allocator_type& __a) : __base(__a) {}
explicit deque(size_type __n);
#if _LIBCPP_STD_VER > 11
explicit deque(size_type __n, const _Allocator& __a);

View File

@ -19,8 +19,7 @@
namespace __gnu_cxx {
using namespace std;
template <typename _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash : public std::hash<_Tp>
{ };
template <typename _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash { };
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<const char*>
: public unary_function<const char*, size_t>
@ -41,6 +40,96 @@ template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char *>
return __do_string_hash<const char *>(__c, __c + strlen(__c));
}
};
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char>
: public unary_function<char, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char __c) const _NOEXCEPT
{
return __c;
}
};
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<signed char>
: public unary_function<signed char, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(signed char __c) const _NOEXCEPT
{
return __c;
}
};
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned char>
: public unary_function<unsigned char, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned char __c) const _NOEXCEPT
{
return __c;
}
};
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<short>
: public unary_function<short, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(short __c) const _NOEXCEPT
{
return __c;
}
};
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned short>
: public unary_function<unsigned short, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned short __c) const _NOEXCEPT
{
return __c;
}
};
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<int>
: public unary_function<int, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(int __c) const _NOEXCEPT
{
return __c;
}
};
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned int>
: public unary_function<unsigned int, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned int __c) const _NOEXCEPT
{
return __c;
}
};
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<long>
: public unary_function<long, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(long __c) const _NOEXCEPT
{
return __c;
}
};
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned long>
: public unary_function<unsigned long, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned long __c) const _NOEXCEPT
{
return __c;
}
};
}
#endif // _LIBCPP_EXT_HASH

View File

@ -430,9 +430,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;

View File

@ -188,7 +188,6 @@ template <class _Tp, class _VoidPtr> struct __forward_list_node;
template <class _NodePtr>
struct __forward_begin_node
{
typedef __forward_begin_node __self;
typedef _NodePtr pointer;
pointer __next_;
@ -197,16 +196,22 @@ struct __forward_begin_node
};
template <class _Tp, class _VoidPtr>
struct __forward_list_node
: public __forward_begin_node
<
typename pointer_traits<_VoidPtr>::template
struct _LIBCPP_HIDDEN __begin_node_of
{
typedef __forward_begin_node
<
typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__forward_list_node<_Tp, _VoidPtr> >
rebind<__forward_list_node<_Tp, _VoidPtr> >
#else
rebind<__forward_list_node<_Tp, _VoidPtr> >::other
rebind<__forward_list_node<_Tp, _VoidPtr> >::other
#endif
>
> type;
};
template <class _Tp, class _VoidPtr>
struct __forward_list_node
: public __begin_node_of<_Tp, _VoidPtr>::type
{
typedef _Tp value_type;
@ -357,9 +362,9 @@ protected:
typedef _Tp value_type;
typedef _Alloc allocator_type;
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
typedef __forward_list_node<value_type, void_pointer> __node;
typedef typename __node::__self __begin_node;
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
typedef __forward_list_node<value_type, void_pointer> __node;
typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node;
typedef typename allocator_traits<allocator_type>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>

View File

@ -1221,7 +1221,7 @@ public:
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type, _ArgTypes...>::type
operator() (_ArgTypes&&... __args)
operator() (_ArgTypes&&... __args) const
{
return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
}
@ -1617,21 +1617,22 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp _
if (__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _FF;
if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value)
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<_FF>
#else
rebind_alloc<_FF>::other
#endif
_Ap;
_Ap __a(__a0);
if (sizeof(_FF) <= sizeof(__buf_) &&
is_nothrow_copy_constructible<_Fp>::value && is_nothrow_copy_constructible<_Ap>::value)
{
__f_ = (__base*)&__buf_;
::new (__f_) _FF(_VSTD::move(__f));
::new (__f_) _FF(_VSTD::move(__f), _Alloc(__a));
}
else
{
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<_FF>
#else
rebind_alloc<_FF>::other
#endif
_Ap;
_Ap __a(__a0);
typedef __allocator_destructor<_Ap> _Dp;
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) _FF(_VSTD::move(__f), _Alloc(__a));

View File

@ -1872,7 +1872,7 @@ template <class _Fp>
__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
: __f_(nullptr)
{
typedef typename remove_reference<_Fp>::type _FR;
typedef typename remove_reference<typename decay<_Fp>::type>::type _FR;
typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
@ -1897,7 +1897,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
: __f_(nullptr)
{
typedef allocator_traits<_Alloc> __alloc_traits;
typedef typename remove_reference<_Fp>::type _FR;
typedef typename remove_reference<typename decay<_Fp>::type>::type _FR;
typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{

View File

@ -519,15 +519,16 @@ std::basic_ostream<_CharT, _Traits> &
__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
_ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
{
__os << __delim;
_VSTD::basic_string<_CharT, _Traits> __str;
__str.push_back(__delim);
for ( ; __first != __last; ++ __first )
{
if (_Traits::eq (*__first, __escape) || _Traits::eq (*__first, __delim))
__os << __escape;
__os << *__first;
__str.push_back(__escape);
__str.push_back(*__first);
}
__os << __delim;
return __os;
__str.push_back(__delim);
return __put_character_sequence(__os, __str.data(), __str.size());
}
template <class _CharT, class _Traits, class _String>

View File

@ -138,6 +138,8 @@ template <class Iterator>
reverse_iterator<Iterator>
operator+(typename reverse_iterator<Iterator>::difference_type n, const reverse_iterator<Iterator>& x);
template <class Iterator> reverse_iterator<Iterator> make_reverse_iterator(Iterator i); // C++14
template <class Container>
class back_insert_iterator
{
@ -327,6 +329,7 @@ template <class C> auto crend(const C& c) -> decltype(std::rend(c)); //
*/
#include <__config>
#include <__functional_base>
#include <type_traits>
#include <cstddef>
#include <iosfwd>
@ -534,7 +537,7 @@ class _LIBCPP_TYPE_VIS_ONLY reverse_iterator
typename iterator_traits<_Iter>::reference>
{
private:
mutable _Iter __t;
mutable _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break
protected:
_Iter current;
public:
@ -548,8 +551,8 @@ public:
template <class _Up> _LIBCPP_INLINE_VISIBILITY reverse_iterator(const reverse_iterator<_Up>& __u)
: __t(__u.base()), current(__u.base()) {}
_LIBCPP_INLINE_VISIBILITY _Iter base() const {return current;}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {__t = current; return *--__t;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {_Iter __tmp = current; return *--__tmp;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return _VSTD::addressof(operator*());}
_LIBCPP_INLINE_VISIBILITY reverse_iterator& operator++() {--current; return *this;}
_LIBCPP_INLINE_VISIBILITY reverse_iterator operator++(int)
{reverse_iterator __tmp(*this); --current; return __tmp;}
@ -632,6 +635,15 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i
return reverse_iterator<_Iter>(__x.base() - __n);
}
#if _LIBCPP_STD_VER > 11
template <class _Iter>
inline _LIBCPP_INLINE_VISIBILITY
reverse_iterator<_Iter> make_reverse_iterator(_Iter __i)
{
return reverse_iterator<_Iter>(__i);
}
#endif
template <class _Container>
class _LIBCPP_TYPE_VIS_ONLY back_insert_iterator
: public iterator<output_iterator_tag,
@ -645,7 +657,7 @@ protected:
public:
typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_)
{container->push_back(__value_); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -678,7 +690,7 @@ protected:
public:
typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_)
{container->push_front(__value_); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -713,7 +725,7 @@ public:
typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x), iter(__i) {}
: container(_VSTD::addressof(__x)), iter(__i) {}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_)
{iter = container->insert(iter, __value_); ++iter; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -1386,7 +1398,7 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
}
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp*
begin(_Tp (&__array)[_Np])
{
@ -1394,7 +1406,7 @@ begin(_Tp (&__array)[_Np])
}
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp*
end(_Tp (&__array)[_Np])
{
@ -1466,17 +1478,17 @@ reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
auto cbegin(const _Cp& __c) -> decltype(begin(__c))
{
return _VSTD::begin(__c);
return begin(__c);
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
auto cend(const _Cp& __c) -> decltype(end(__c))
{
return _VSTD::end(__c);
return end(__c);
}
template <class _Cp>

View File

@ -417,7 +417,7 @@ int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
// and failbit is set in __err.
// Else an iterator pointing to the matching keyword is found. If more than
// one keyword matches, an iterator to the first matching keyword is returned.
// If on exit __b == __e, eofbit is set in __err. If __case_senstive is false,
// If on exit __b == __e, eofbit is set in __err. If __case_sensitive is false,
// __ct is used to force to lower case before comparing characters.
// Examples:
// Keywords: "a", "abb"
@ -1012,7 +1012,7 @@ num_get<_CharT, _InputIterator>::__do_get_signed(iter_type __b, iter_type __e,
unsigned __dc = 0;
for (; __b != __e; ++__b)
{
if (__a_end - __a == __buf.size())
if (__a_end == __a + __buf.size())
{
size_t __tmp = __buf.size();
__buf.resize(2*__buf.size());
@ -1062,7 +1062,7 @@ num_get<_CharT, _InputIterator>::__do_get_unsigned(iter_type __b, iter_type __e,
unsigned __dc = 0;
for (; __b != __e; ++__b)
{
if (__a_end - __a == __buf.size())
if (__a_end == __a + __buf.size())
{
size_t __tmp = __buf.size();
__buf.resize(2*__buf.size());
@ -1116,7 +1116,7 @@ num_get<_CharT, _InputIterator>::__do_get_floating_point(iter_type __b, iter_typ
char __exp = 'E';
for (; __b != __e; ++__b)
{
if (__a_end - __a == __buf.size())
if (__a_end == __a + __buf.size())
{
size_t __tmp = __buf.size();
__buf.resize(2*__buf.size());
@ -1166,7 +1166,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
unsigned __dc = 0;
for (; __b != __e; ++__b)
{
if (__a_end - __a == __buf.size())
if (__a_end == __a + __buf.size())
{
size_t __tmp = __buf.size();
__buf.resize(2*__buf.size());
@ -2038,7 +2038,7 @@ template <class _CharT, class _InputIterator>
locale::id
time_get<_CharT, _InputIterator>::id;
// time_get primatives
// time_get primitives
template <class _CharT, class _InputIterator>
void
@ -2259,7 +2259,7 @@ time_get<_CharT, _InputIterator>::__get_percent(iter_type& __b, iter_type __e,
__err |= ios_base::eofbit;
}
// time_get end primatives
// time_get end primitives
template <class _CharT, class _InputIterator>
_InputIterator

View File

@ -835,11 +835,18 @@ public:
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit map(const key_compare& __comp = key_compare())
map()
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__vc(key_compare())) {}
_LIBCPP_INLINE_VISIBILITY
explicit map(const key_compare& __comp)
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__vc(__comp)) {}
_LIBCPP_INLINE_VISIBILITY
@ -884,10 +891,12 @@ public:
#if __cplusplus >= 201103L
__tree_ = __m.__tree_;
#else
__tree_.clear();
__tree_.value_comp() = __m.__tree_.value_comp();
__tree_.__copy_assign_alloc(__m.__tree_);
insert(__m.begin(), __m.end());
if (this != &__m) {
__tree_.clear();
__tree_.value_comp() = __m.__tree_.value_comp();
__tree_.__copy_assign_alloc(__m.__tree_);
insert(__m.begin(), __m.end());
}
#endif
return *this;
}
@ -1566,11 +1575,18 @@ public:
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const key_compare& __comp = key_compare())
multimap()
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__vc(key_compare())) {}
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const key_compare& __comp)
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__vc(__comp)) {}
_LIBCPP_INLINE_VISIBILITY
@ -1616,10 +1632,12 @@ public:
#if __cplusplus >= 201103L
__tree_ = __m.__tree_;
#else
__tree_.clear();
__tree_.value_comp() = __m.__tree_.value_comp();
__tree_.__copy_assign_alloc(__m.__tree_);
insert(__m.begin(), __m.end());
if (this != &__m) {
__tree_.clear();
__tree_.value_comp() = __m.__tree_.value_comp();
__tree_.__copy_assign_alloc(__m.__tree_);
insert(__m.begin(), __m.end());
}
#endif
return *this;
}

View File

@ -479,6 +479,8 @@ public:
template<class Y> weak_ptr(shared_ptr<Y> const& r) noexcept;
weak_ptr(weak_ptr const& r) noexcept;
template<class Y> weak_ptr(weak_ptr<Y> const& r) noexcept;
weak_ptr(weak_ptr&& r) noexcept; // C++14
template<class Y> weak_ptr(weak_ptr<Y>&& r) noexcept; // C++14
// destructor
~weak_ptr();
@ -487,6 +489,8 @@ public:
weak_ptr& operator=(weak_ptr const& r) noexcept;
template<class Y> weak_ptr& operator=(weak_ptr<Y> const& r) noexcept;
template<class Y> weak_ptr& operator=(shared_ptr<Y> const& r) noexcept;
weak_ptr& operator=(weak_ptr&& r) noexcept; // C++14
template<class Y> weak_ptr& operator=(weak_ptr<Y>&& r) noexcept; // C++14
// modifiers
void swap(weak_ptr& r) noexcept;
@ -2397,13 +2401,14 @@ template <class _Ptr1, class _Ptr2>
struct __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false>
: false_type {};
template <class _Ptr1, class _Ptr2, bool = is_scalar<_Ptr1>::value &&
!is_pointer<_Ptr1>::value>
template <class _Ptr1, class _Ptr2, bool = is_pointer<_Ptr1>::value ||
is_same<_Ptr1, _Ptr2>::value ||
__has_element_type<_Ptr1>::value>
struct __same_or_less_cv_qualified
: __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {};
template <class _Ptr1, class _Ptr2>
struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, true>
struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, false>
: false_type {};
// default_delete
@ -2666,23 +2671,21 @@ public:
"unique_ptr constructed with null function pointer deleter");
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Pp,
class = typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value>::type
>
_LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p) _NOEXCEPT
template <class _Pp>
_LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p,
typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat()) _NOEXCEPT
: __ptr_(__p)
{
static_assert(!is_pointer<deleter_type>::value,
"unique_ptr constructed with null function pointer deleter");
}
template <class _Pp,
class = typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value>::type
>
template <class _Pp>
_LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename conditional<
is_reference<deleter_type>::value,
deleter_type,
typename add_lvalue_reference<const deleter_type>::type>::type __d)
typename add_lvalue_reference<const deleter_type>::type>::type __d,
typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat())
_NOEXCEPT
: __ptr_(__p, __d) {}
@ -2693,10 +2696,10 @@ public:
_NOEXCEPT
: __ptr_(pointer(), __d) {}
template <class _Pp,
class = typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value>::type
>
_LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename remove_reference<deleter_type>::type&& __d)
template <class _Pp>
_LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p,
typename remove_reference<deleter_type>::type&& __d,
typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat())
_NOEXCEPT
: __ptr_(__p, _VSTD::move(__d))
{
@ -2811,10 +2814,10 @@ public:
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Pp,
class = typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value>::type
>
_LIBCPP_INLINE_VISIBILITY void reset(_Pp __p) _NOEXCEPT
template <class _Pp>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, void>::type
reset(_Pp __p) _NOEXCEPT
{
pointer __tmp = __ptr_.first();
__ptr_.first() = __p;
@ -3759,27 +3762,15 @@ private:
public:
_LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT;
_LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
template<class _Yp,
class = typename enable_if
<
is_convertible<_Yp*, element_type*>::value
>::type
>
explicit shared_ptr(_Yp* __p);
template<class _Yp, class _Dp,
class = typename enable_if
<
is_convertible<_Yp*, element_type*>::value
>::type
>
shared_ptr(_Yp* __p, _Dp __d);
template<class _Yp, class _Dp, class _Alloc,
class = typename enable_if
<
is_convertible<_Yp*, element_type*>::value
>::type
>
shared_ptr(_Yp* __p, _Dp __d, _Alloc __a);
template<class _Yp>
explicit shared_ptr(_Yp* __p,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
template<class _Yp, class _Dp>
shared_ptr(_Yp* __p, _Dp __d,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
template<class _Yp, class _Dp, class _Alloc>
shared_ptr(_Yp* __p, _Dp __d, _Alloc __a,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d);
template <class _Dp, class _Alloc> shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a);
template<class _Yp> shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
@ -3797,59 +3788,52 @@ public:
template<class _Yp> explicit shared_ptr(const weak_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type= __nat());
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Yp,
class = typename enable_if
<
is_convertible<_Yp*, element_type*>::value
>::type
>
shared_ptr(auto_ptr<_Yp>&& __r);
template<class _Yp>
shared_ptr(auto_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
#else
template<class _Yp,
class = typename enable_if
<
is_convertible<_Yp*, element_type*>::value
>::type
>
shared_ptr(auto_ptr<_Yp> __r);
template<class _Yp>
shared_ptr(auto_ptr<_Yp> __r,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Yp, class _Dp,
class = typename enable_if
<
!is_array<_Yp>::value &&
is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
>::type
>
shared_ptr(unique_ptr<_Yp, _Dp>&&,
typename enable_if<!is_lvalue_reference<_Dp>::value, __nat>::type = __nat());
template <class _Yp, class _Dp,
class = typename enable_if
<
!is_array<_Yp>::value &&
is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
>::type
>
shared_ptr(unique_ptr<_Yp, _Dp>&&,
typename enable_if<is_lvalue_reference<_Dp>::value, __nat>::type = __nat());
template <class _Yp, class _Dp>
shared_ptr(unique_ptr<_Yp, _Dp>&&,
typename enable_if
<
!is_lvalue_reference<_Dp>::value &&
!is_array<_Yp>::value &&
is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
__nat
>::type = __nat());
template <class _Yp, class _Dp>
shared_ptr(unique_ptr<_Yp, _Dp>&&,
typename enable_if
<
is_lvalue_reference<_Dp>::value &&
!is_array<_Yp>::value &&
is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
__nat
>::type = __nat());
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Yp, class _Dp,
class = typename enable_if
<
!is_array<_Yp>::value &&
is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
>::type
> shared_ptr(unique_ptr<_Yp, _Dp>,
typename enable_if<!is_lvalue_reference<_Dp>::value, __nat>::type = __nat());
template <class _Yp, class _Dp,
class = typename enable_if
<
!is_array<_Yp>::value &&
is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
>::type
>
shared_ptr(unique_ptr<_Yp, _Dp>,
typename enable_if<is_lvalue_reference<_Dp>::value, __nat>::type = __nat());
template <class _Yp, class _Dp>
shared_ptr(unique_ptr<_Yp, _Dp>,
typename enable_if
<
!is_lvalue_reference<_Dp>::value &&
!is_array<_Yp>::value &&
is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
__nat
>::type = __nat());
template <class _Yp, class _Dp>
shared_ptr(unique_ptr<_Yp, _Dp>,
typename enable_if
<
is_lvalue_reference<_Dp>::value &&
!is_array<_Yp>::value &&
is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
__nat
>::type = __nat());
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~shared_ptr();
@ -4039,8 +4023,9 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT
}
template<class _Tp>
template<class _Yp, class>
shared_ptr<_Tp>::shared_ptr(_Yp* __p)
template<class _Yp>
shared_ptr<_Tp>::shared_ptr(_Yp* __p,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
: __ptr_(__p)
{
unique_ptr<_Yp> __hold(__p);
@ -4051,8 +4036,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p)
}
template<class _Tp>
template<class _Yp, class _Dp, class>
shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d)
template<class _Yp, class _Dp>
shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
: __ptr_(__p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
@ -4094,8 +4080,9 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d)
}
template<class _Tp>
template<class _Yp, class _Dp, class _Alloc, class>
shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a)
template<class _Yp, class _Dp, class _Alloc>
shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
: __ptr_(__p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
@ -4208,12 +4195,13 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r,
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
template<class _Yp, class>
template<class _Yp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp>&& __r)
shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp>&& __r,
#else
shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r)
shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r,
#endif
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
: __ptr_(__r.get())
{
typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
@ -4223,13 +4211,19 @@ shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r)
}
template<class _Tp>
template <class _Yp, class _Dp, class>
template <class _Yp, class _Dp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r,
#else
shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
#endif
typename enable_if<!is_lvalue_reference<_Dp>::value, __nat>::type)
typename enable_if
<
!is_lvalue_reference<_Dp>::value &&
!is_array<_Yp>::value &&
is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
__nat
>::type)
: __ptr_(__r.get())
{
typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
@ -4239,13 +4233,19 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
}
template<class _Tp>
template <class _Yp, class _Dp, class>
template <class _Yp, class _Dp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r,
#else
shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
#endif
typename enable_if<is_lvalue_reference<_Dp>::value, __nat>::type)
typename enable_if
<
is_lvalue_reference<_Dp>::value &&
!is_array<_Yp>::value &&
is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
__nat
>::type)
: __ptr_(__r.get())
{
typedef __shared_ptr_pointer<_Yp*,

View File

@ -765,7 +765,7 @@ template<class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
{
return _VSTD::__put_character_sequence(__os, &__c, 1);
return _VSTD::__put_character_sequence(__os, &__c, 1);
}
template<class _CharT, class _Traits>
@ -805,28 +805,28 @@ template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __os, char __c)
{
return _VSTD::__put_character_sequence(__os, &__c, 1);
return _VSTD::__put_character_sequence(__os, &__c, 1);
}
template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
{
return _VSTD::__put_character_sequence(__os, (char *) &__c, 1);
return _VSTD::__put_character_sequence(__os, (char *) &__c, 1);
}
template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
{
return _VSTD::__put_character_sequence(__os, (char *) &__c, 1);
return _VSTD::__put_character_sequence(__os, (char *) &__c, 1);
}
template<class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
{
return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str));
return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str));
}
template<class _CharT, class _Traits>
@ -879,23 +879,23 @@ template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
{
return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str));
return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str));
}
template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
{
const char *__s = (const char *) __str;
return _VSTD::__put_character_sequence(__os, __s, _Traits::length(__s));
const char *__s = (const char *) __str;
return _VSTD::__put_character_sequence(__os, __s, _Traits::length(__s));
}
template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
{
const char *__s = (const char *) __str;
return _VSTD::__put_character_sequence(__os, __s, _Traits::length(__s));
const char *__s = (const char *) __str;
return _VSTD::__put_character_sequence(__os, __s, _Traits::length(__s));
}
template <class _CharT, class _Traits>
@ -1065,7 +1065,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const basic_string<_CharT, _Traits, _Allocator>& __str)
{
return _VSTD::__put_character_sequence(__os, __str.data(), __str.size());
return _VSTD::__put_character_sequence(__os, __str.data(), __str.size());
}
template <class _CharT, class _Traits>

View File

@ -437,7 +437,7 @@ class match_results
public:
typedef sub_match<BidirectionalIterator> value_type;
typedef const value_type& const_reference;
typedef const_reference reference;
typedef value_type& reference;
typedef /implementation-defined/ const_iterator;
typedef const_iterator iterator;
typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
@ -546,6 +546,13 @@ template <class ST, class SA, class Allocator, class charT, class traits>
const basic_regex<charT, traits>& e,
regex_constants::match_flag_type flags = regex_constants::match_default);
template <class ST, class SA, class Allocator, class charT, class traits>
bool
regex_match(const basic_string<charT, ST, SA>&& s,
match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
const basic_regex<charT, traits>& e,
regex_constants::match_flag_type flags = regex_constants::match_default) = delete; // C++14
template <class charT, class traits>
bool
regex_match(const charT* str, const basic_regex<charT, traits>& e,
@ -594,6 +601,13 @@ template <class ST, class SA, class Allocator, class charT, class traits>
const basic_regex<charT, traits>& e,
regex_constants::match_flag_type flags = regex_constants::match_default);
template <class ST, class SA, class Allocator, class charT, class traits>
bool
regex_search(const basic_string<charT, ST, SA>&& s,
match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
const basic_regex<charT, traits>& e,
regex_constants::match_flag_type flags = regex_constants::match_default) = delete; // C++14
template <class OutputIterator, class BidirectionalIterator,
class traits, class charT, class ST, class SA>
OutputIterator
@ -655,6 +669,10 @@ public:
regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
const regex_type& re,
regex_constants::match_flag_type m = regex_constants::match_default);
regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type&& __re,
regex_constants::match_flag_type __m
= regex_constants::match_default) = delete; // C++14
regex_iterator(const regex_iterator&);
regex_iterator& operator=(const regex_iterator&);
@ -690,16 +708,29 @@ public:
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
const regex_type& re, int submatch = 0,
regex_constants::match_flag_type m = regex_constants::match_default);
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
const regex_type&& re, int submatch = 0,
regex_constants::match_flag_type m = regex_constants::match_default) = delete; // C++14
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
const regex_type& re, const vector<int>& submatches,
regex_constants::match_flag_type m = regex_constants::match_default);
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
const regex_type&& re, const vector<int>& submatches,
regex_constants::match_flag_type m = regex_constants::match_default) = delete; // C++14
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);
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) = delete; // C++14
template <size_t N>
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
const regex_type& re, const int (&submatches)[N],
regex_constants::match_flag_type m = regex_constants::match_default);
template <size_t N>
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
const regex_type& re, const int (&submatches)[N],
regex_constants::match_flag_type m = regex_constants::match_default) = delete // C++14;
regex_token_iterator(const regex_token_iterator&);
regex_token_iterator& operator=(const regex_token_iterator&);
@ -3310,10 +3341,14 @@ basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first,
_ForwardIterator __temp = _VSTD::next(__first);
if (__temp != __last)
{
if (*__first == '\\' && '1' <= *__temp && *__temp <= '9')
{
__push_back_ref(*__temp - '0');
__first = ++__temp;
if (*__first == '\\')
{
int __val = __traits_.value(*__temp, 10);
if (__val >= 1 && __val <= 9)
{
__push_back_ref(__val);
__first = ++__temp;
}
}
}
}
@ -4052,14 +4087,19 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first,
_ForwardIterator __last,
int& __c)
{
if (__first != __last && '0' <= *__first && *__first <= '9')
if (__first != __last )
{
__c = *__first - '0';
for (++__first; __first != __last && '0' <= *__first && *__first <= '9';
++__first)
int __val = __traits_.value(*__first, 10);
if ( __val != -1 )
{
__c *= 10;
__c += *__first - '0';
__c = __val;
for (++__first;
__first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
++__first)
{
__c *= 10;
__c += __val;
}
}
}
return __first;
@ -5223,7 +5263,7 @@ private:
public:
_BidirectionalIterator __position_start_;
typedef const value_type& const_reference;
typedef const_reference reference;
typedef value_type& reference;
typedef typename __container_type::const_iterator const_iterator;
typedef const_iterator iterator;
typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
@ -5934,6 +5974,15 @@ regex_search(const basic_string<_CharT, _ST, _SA>& __s,
return __r;
}
#if _LIBCPP_STD_VER > 11
template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
bool
regex_search(const basic_string<_Cp, _ST, _SA>&& __s,
match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
const basic_regex<_Cp, _Tp>& __e,
regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
#endif
// regex_match
template <class _BidirectionalIterator, class _Allocator, class _CharT, class _Traits>
@ -5986,6 +6035,16 @@ regex_match(const basic_string<_CharT, _ST, _SA>& __s,
return _VSTD::regex_match(__s.begin(), __s.end(), __m, __e, __flags);
}
#if _LIBCPP_STD_VER > 11
template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
bool
regex_match(const basic_string<_CharT, _ST, _SA>&& __s,
match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
#endif
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
bool
@ -6031,7 +6090,14 @@ public:
regex_iterator();
regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type& __re,
regex_constants::match_flag_type __m = regex_constants::match_default);
regex_constants::match_flag_type __m
= regex_constants::match_default);
#if _LIBCPP_STD_VER > 11
regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type&& __re,
regex_constants::match_flag_type __m
= regex_constants::match_default) = delete;
#endif
bool operator==(const regex_iterator& __x) const;
_LIBCPP_INLINE_VISIBILITY
@ -6147,16 +6213,38 @@ public:
const regex_type& __re, int __submatch = 0,
regex_constants::match_flag_type __m =
regex_constants::match_default);
#if _LIBCPP_STD_VER > 11
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type&& __re, int __submatch = 0,
regex_constants::match_flag_type __m =
regex_constants::match_default) = delete;
#endif
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type& __re, const vector<int>& __submatches,
regex_constants::match_flag_type __m =
regex_constants::match_default);
#if _LIBCPP_STD_VER > 11
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type&& __re, const vector<int>& __submatches,
regex_constants::match_flag_type __m =
regex_constants::match_default) = delete;
#endif
#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);
#if _LIBCPP_STD_VER > 11
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) = delete;
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <size_t _Np>
regex_token_iterator(_BidirectionalIterator __a,
@ -6165,6 +6253,16 @@ public:
const int (&__submatches)[_Np],
regex_constants::match_flag_type __m =
regex_constants::match_default);
#if _LIBCPP_STD_VER > 11
template <std::size_t _Np>
regex_token_iterator(_BidirectionalIterator __a,
_BidirectionalIterator __b,
const regex_type&& __re,
const int (&__submatches)[_Np],
regex_constants::match_flag_type __m =
regex_constants::match_default) = delete;
#endif
regex_token_iterator(const regex_token_iterator&);
regex_token_iterator& operator=(const regex_token_iterator&);
@ -6188,6 +6286,12 @@ public:
private:
void __init(_BidirectionalIterator __a, _BidirectionalIterator __b);
void __establish_result () {
if (__subs_[_N_] == -1)
__result_ = &__position_->prefix();
else
__result_ = &(*__position_)[__subs_[_N_]];
}
};
template <class _BidirectionalIterator, class _CharT, class _Traits>
@ -6205,12 +6309,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
__init(_BidirectionalIterator __a, _BidirectionalIterator __b)
{
if (__position_ != _Position())
{
if (__subs_[_N_] == -1)
__result_ = &__position_->prefix();
else
__result_ = &(*__position_)[__subs_[_N_]];
}
__establish_result ();
else if (__subs_[_N_] == -1)
{
__suffix_.matched = true;
@ -6287,7 +6386,9 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
__subs_(__x.__subs_)
{
if (__x.__result_ == &__x.__suffix_)
__result_ == &__suffix_;
__result_ = &__suffix_;
else if ( __result_ != nullptr )
__establish_result ();
}
template <class _BidirectionalIterator, class _CharT, class _Traits>
@ -6299,12 +6400,15 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
{
__position_ = __x.__position_;
if (__x.__result_ == &__x.__suffix_)
__result_ == &__suffix_;
__result_ = &__suffix_;
else
__result_ = __x.__result_;
__suffix_ = __x.__suffix_;
_N_ = __x._N_;
__subs_ = __x.__subs_;
if ( __result_ != nullptr && __result_ != &__suffix_ )
__establish_result();
}
return *this;
}
@ -6337,22 +6441,14 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
else if (_N_ + 1 < __subs_.size())
{
++_N_;
if (__subs_[_N_] == -1)
__result_ = &__position_->prefix();
else
__result_ = &(*__position_)[__subs_[_N_]];
__establish_result();
}
else
{
_N_ = 0;
++__position_;
if (__position_ != _Position())
{
if (__subs_[_N_] == -1)
__result_ = &__position_->prefix();
else
__result_ = &(*__position_)[__subs_[_N_]];
}
__establish_result();
else
{
if (_VSTD::find(__subs_.begin(), __subs_.end(), -1) != __subs_.end()

View File

@ -425,14 +425,22 @@ public:
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit set(const value_compare& __comp = value_compare())
set()
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {}
: __tree_(value_compare()) {}
_LIBCPP_INLINE_VISIBILITY
set(const value_compare& __comp, const allocator_type& __a)
explicit set(const value_compare& __comp)
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY
explicit set(const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
@ -822,14 +830,22 @@ public:
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
explicit multiset(const value_compare& __comp = value_compare())
multiset()
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {}
: __tree_(value_compare()) {}
_LIBCPP_INLINE_VISIBILITY
multiset(const value_compare& __comp, const allocator_type& __a)
explicit multiset(const value_compare& __comp)
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY
explicit multiset(const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY

View File

@ -19,14 +19,14 @@
namespace std
{
class shared_mutex
class shared_timed_mutex
{
public:
shared_mutex();
~shared_mutex();
shared_timed_mutex();
~shared_timed_mutex();
shared_mutex(const shared_mutex&) = delete;
shared_mutex& operator=(const shared_mutex&) = delete;
shared_timed_mutex(const shared_timed_mutex&) = delete;
shared_timed_mutex& operator=(const shared_timed_mutex&) = delete;
// Exclusive ownership
void lock(); // blocking
@ -114,7 +114,7 @@ template <class Mutex>
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS shared_mutex
class _LIBCPP_TYPE_VIS shared_timed_mutex
{
mutex __mut_;
condition_variable __gate1_;
@ -124,11 +124,11 @@ class _LIBCPP_TYPE_VIS shared_mutex
static const unsigned __write_entered_ = 1U << (sizeof(unsigned)*__CHAR_BIT__ - 1);
static const unsigned __n_readers_ = ~__write_entered_;
public:
shared_mutex();
_LIBCPP_INLINE_VISIBILITY ~shared_mutex() = default;
shared_timed_mutex();
_LIBCPP_INLINE_VISIBILITY ~shared_timed_mutex() = default;
shared_mutex(const shared_mutex&) = delete;
shared_mutex& operator=(const shared_mutex&) = delete;
shared_timed_mutex(const shared_timed_mutex&) = delete;
shared_timed_mutex& operator=(const shared_timed_mutex&) = delete;
// Exclusive ownership
void lock();
@ -163,7 +163,7 @@ public:
template <class _Clock, class _Duration>
bool
shared_mutex::try_lock_until(
shared_timed_mutex::try_lock_until(
const chrono::time_point<_Clock, _Duration>& __abs_time)
{
unique_lock<mutex> __lk(__mut_);
@ -198,7 +198,7 @@ shared_mutex::try_lock_until(
template <class _Clock, class _Duration>
bool
shared_mutex::try_lock_shared_until(
shared_timed_mutex::try_lock_shared_until(
const chrono::time_point<_Clock, _Duration>& __abs_time)
{
unique_lock<mutex> __lk(__mut_);

View File

@ -50,6 +50,14 @@ public:
#pragma GCC system_header
#endif
#ifndef _LIBCPP___REFSTRING
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_HIDDEN __libcpp_refstring {
const char *__imp_;
};
_LIBCPP_END_NAMESPACE_STD
#endif
namespace std // purposefully not using versioning namespace
{
@ -57,7 +65,7 @@ class _LIBCPP_EXCEPTION_ABI logic_error
: public exception
{
private:
void* __imp_;
_VSTD::__libcpp_refstring __imp_;
public:
explicit logic_error(const string&);
explicit logic_error(const char*);
@ -74,7 +82,7 @@ class _LIBCPP_EXCEPTION_ABI runtime_error
: public exception
{
private:
void* __imp_;
_VSTD::__libcpp_refstring __imp_;
public:
explicit runtime_error(const string&);
explicit runtime_error(const char*);

View File

@ -161,7 +161,7 @@ public:
basic_string& operator+=(initializer_list<value_type>);
basic_string& append(const basic_string& str);
basic_string& append(const basic_string& str, size_type pos, size_type n);
basic_string& append(const basic_string& str, size_type pos, size_type n=npos); //C++14
basic_string& append(const value_type* s, size_type n);
basic_string& append(const value_type* s);
basic_string& append(size_type n, value_type c);
@ -178,7 +178,7 @@ public:
basic_string& assign(const basic_string& str);
basic_string& assign(basic_string&& str);
basic_string& assign(const basic_string& str, size_type pos, size_type n);
basic_string& assign(const basic_string& str, size_type pos, size_type n=npos); // C++14
basic_string& assign(const value_type* s, size_type n);
basic_string& assign(const value_type* s);
basic_string& assign(size_type n, value_type c);
@ -189,7 +189,7 @@ public:
basic_string& insert(size_type pos1, const basic_string& str);
basic_string& insert(size_type pos1, const basic_string& str,
size_type pos2, size_type n);
basic_string& insert(size_type pos, const value_type* s, size_type n);
basic_string& insert(size_type pos, const value_type* s, size_type n=npos); //C++14
basic_string& insert(size_type pos, const value_type* s);
basic_string& insert(size_type pos, size_type n, value_type c);
iterator insert(const_iterator p, value_type c);
@ -204,7 +204,7 @@ public:
basic_string& replace(size_type pos1, size_type n1, const basic_string& str);
basic_string& replace(size_type pos1, size_type n1, const basic_string& str,
size_type pos2, size_type n2);
size_type pos2, size_type n2=npos); // C++14
basic_string& replace(size_type pos, size_type n1, const value_type* s, size_type n2);
basic_string& replace(size_type pos, size_type n1, const value_type* s);
basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
@ -261,7 +261,7 @@ public:
int compare(const basic_string& str) const noexcept;
int compare(size_type pos1, size_type n1, const basic_string& str) const;
int compare(size_type pos1, size_type n1, const basic_string& str,
size_type pos2, size_type n2) const;
size_type pos2, size_type n2=npos) const; // C++14
int compare(const value_type* s) const noexcept;
int compare(size_type pos1, size_type n1, const value_type* s) const;
int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const;
@ -1426,7 +1426,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_string& append(const basic_string& __str);
basic_string& append(const basic_string& __str, size_type __pos, size_type __n);
basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
basic_string& append(const value_type* __s, size_type __n);
basic_string& append(const value_type* __s);
basic_string& append(size_type __n, value_type __c);
@ -1465,7 +1465,7 @@ public:
basic_string& assign(basic_string&& str)
{*this = _VSTD::move(str); return *this;}
#endif
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n);
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
basic_string& assign(const value_type* __s, size_type __n);
basic_string& assign(const value_type* __s);
basic_string& assign(size_type __n, value_type __c);
@ -1491,7 +1491,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_string& insert(size_type __pos1, const basic_string& __str);
basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n);
basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n=npos);
basic_string& insert(size_type __pos, const value_type* __s, size_type __n);
basic_string& insert(size_type __pos, const value_type* __s);
basic_string& insert(size_type __pos, size_type __n, value_type __c);
@ -1527,7 +1527,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2);
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);
basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2);
basic_string& replace(size_type __pos, size_type __n1, const value_type* __s);
basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
@ -1619,7 +1619,7 @@ public:
int compare(const basic_string& __str) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const;
int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos) const;
int compare(const value_type* __s) const _NOEXCEPT;
int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
@ -2311,7 +2311,7 @@ template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n)
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign recieved nullptr");
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr");
size_type __cap = capacity();
if (__cap >= __n)
{
@ -2485,7 +2485,7 @@ template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)
{
_LIBCPP_ASSERT(__s != nullptr, "string::assign recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr");
return assign(__s, traits_type::length(__s));
}
@ -2495,7 +2495,7 @@ template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n)
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::append recieved nullptr");
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::append received nullptr");
size_type __cap = capacity();
size_type __sz = size();
if (__cap - __sz >= __n)
@ -2632,7 +2632,7 @@ template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)
{
_LIBCPP_ASSERT(__s != nullptr, "string::append recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::append received nullptr");
return append(__s, traits_type::length(__s));
}
@ -2642,7 +2642,7 @@ template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n)
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert recieved nullptr");
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert received nullptr");
size_type __sz = size();
if (__pos > __sz)
this->__throw_out_of_range();
@ -2794,7 +2794,7 @@ template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s)
{
_LIBCPP_ASSERT(__s != nullptr, "string::insert recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::insert received nullptr");
return insert(__pos, __s, traits_type::length(__s));
}
@ -2845,7 +2845,7 @@ template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
{
_LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace recieved nullptr");
_LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
size_type __sz = size();
if (__pos > __sz)
this->__throw_out_of_range();
@ -2977,7 +2977,7 @@ template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s)
{
_LIBCPP_ASSERT(__s != nullptr, "string::replace recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::replace received nullptr");
return replace(__pos, __n1, __s, traits_type::length(__s));
}
@ -3345,7 +3345,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
size_type __pos,
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): recieved nullptr");
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr");
size_type __sz = size();
if (__pos > __sz || __sz - __pos < __n)
return npos;
@ -3374,7 +3374,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::find(): recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr");
return find(__s, __pos, traits_type::length(__s));
}
@ -3401,7 +3401,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
size_type __pos,
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): recieved nullptr");
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
size_type __sz = size();
__pos = _VSTD::min(__pos, __sz);
if (__n < __sz - __pos)
@ -3431,7 +3431,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::rfind(): recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr");
return rfind(__s, __pos, traits_type::length(__s));
}
@ -3465,9 +3465,9 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
size_type __pos,
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): recieved nullptr");
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
return _VSTD::__find_first_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
(data(), size(), __s, __pos, __n);
}
template<class _CharT, class _Traits, class _Allocator>
@ -3477,7 +3477,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __s
size_type __pos) const _NOEXCEPT
{
return _VSTD::__find_first_of<value_type, size_type, traits_type, npos>
(data(), size(), __str.data(), __pos, __str.size());
(data(), size(), __str.data(), __pos, __str.size());
}
template<class _CharT, class _Traits, class _Allocator>
@ -3486,9 +3486,9 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr");
return _VSTD::__find_first_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
(data(), size(), __s, __pos, traits_type::length(__s));
}
template<class _CharT, class _Traits, class _Allocator>
@ -3508,9 +3508,9 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
size_type __pos,
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): recieved nullptr");
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
return _VSTD::__find_last_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
(data(), size(), __s, __pos, __n);
}
template<class _CharT, class _Traits, class _Allocator>
@ -3520,7 +3520,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __st
size_type __pos) const _NOEXCEPT
{
return _VSTD::__find_last_of<value_type, size_type, traits_type, npos>
(data(), size(), __str.data(), __pos, __str.size());
(data(), size(), __str.data(), __pos, __str.size());
}
template<class _CharT, class _Traits, class _Allocator>
@ -3529,9 +3529,9 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr");
return _VSTD::__find_last_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
(data(), size(), __s, __pos, traits_type::length(__s));
}
template<class _CharT, class _Traits, class _Allocator>
@ -3551,9 +3551,9 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _
size_type __pos,
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): recieved nullptr");
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
(data(), size(), __s, __pos, __n);
}
template<class _CharT, class _Traits, class _Allocator>
@ -3563,7 +3563,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string&
size_type __pos) const _NOEXCEPT
{
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __str.data(), __pos, __str.size());
(data(), size(), __str.data(), __pos, __str.size());
}
template<class _CharT, class _Traits, class _Allocator>
@ -3572,9 +3572,9 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr");
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
(data(), size(), __s, __pos, traits_type::length(__s));
}
template<class _CharT, class _Traits, class _Allocator>
@ -3584,7 +3584,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
size_type __pos) const _NOEXCEPT
{
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __c, __pos);
(data(), size(), __c, __pos);
}
// find_last_not_of
@ -3595,9 +3595,9 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __
size_type __pos,
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): recieved nullptr");
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
(data(), size(), __s, __pos, __n);
}
template<class _CharT, class _Traits, class _Allocator>
@ -3607,7 +3607,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string&
size_type __pos) const _NOEXCEPT
{
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __str.data(), __pos, __str.size());
(data(), size(), __str.data(), __pos, __str.size());
}
template<class _CharT, class _Traits, class _Allocator>
@ -3616,9 +3616,9 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr");
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
(data(), size(), __s, __pos, traits_type::length(__s));
}
template<class _CharT, class _Traits, class _Allocator>
@ -3628,7 +3628,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
size_type __pos) const _NOEXCEPT
{
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __c, __pos);
(data(), size(), __c, __pos);
}
// compare
@ -3680,7 +3680,7 @@ template <class _CharT, class _Traits, class _Allocator>
int
basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::compare(): recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr");
return compare(0, npos, __s, traits_type::length(__s));
}
@ -3690,7 +3690,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
size_type __n1,
const value_type* __s) const
{
_LIBCPP_ASSERT(__s != nullptr, "string::compare(): recieved nullptr");
_LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr");
return compare(__pos1, __n1, __s, traits_type::length(__s));
}
@ -3701,7 +3701,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
const value_type* __s,
size_type __n2) const
{
_LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): recieved nullptr");
_LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr");
size_type __sz = size();
if (__pos1 > __sz || __n2 == npos)
this->__throw_out_of_range();

View File

@ -74,7 +74,7 @@ const unspecified ignore;
template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++14
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept; // constexpr in C++14
template <class... T> tuple<T&...> tie(T&...) noexcept;
template <class... T> tuple<T&...> tie(T&...) noexcept; // constexpr in C++14
template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls); // constexpr in C++14
// 20.4.1.4, tuple helper classes:
@ -82,13 +82,15 @@ template <class T> class tuple_size; // undefined
template <class... T> class tuple_size<tuple<T...>>;
template <intsize_t I, class T> class tuple_element; // undefined
template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
template <size_t _Ip, class ..._Tp>
using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; // C++14
// 20.4.1.5, element access:
template <intsize_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&
get(tuple<T...>&) noexcept; // constexpr in C++14
template <intsize_t I, class... T>
typename tuple_element<I, tuple<T...>>::type const&
typename const tuple_element<I, tuple<T...>>::type &
get(const tuple<T...>&) noexcept; // constexpr in C++14
template <intsize_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&&
@ -152,6 +154,11 @@ public:
typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
};
#if _LIBCPP_STD_VER > 11
template <size_t _Ip, class ..._Tp>
using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type;
#endif
// __tuple_leaf
template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value
@ -261,17 +268,8 @@ public:
>::value)),
"Attempted to construct a reference element in a tuple with an rvalue");}
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11
__tuple_leaf(const __tuple_leaf& __t) _NOEXCEPT_(is_nothrow_copy_constructible<_Hp>::value)
: value(__t.get())
{static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");}
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11
__tuple_leaf(__tuple_leaf&& __t) _NOEXCEPT_(is_nothrow_move_constructible<_Hp>::value)
: value(_VSTD::forward<_Hp>(__t.get()))
{}
__tuple_leaf(const __tuple_leaf& __t) = default;
__tuple_leaf(__tuple_leaf&& __t) = default;
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
@ -796,7 +794,7 @@ constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept
// tie
template <class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
tuple<_Tp&...>
tie(_Tp&... __t) _NOEXCEPT
{

View File

@ -91,6 +91,7 @@ namespace std
template <class T> struct is_empty;
template <class T> struct is_polymorphic;
template <class T> struct is_abstract;
template <class T> struct is_final; // C++14
template <class T, class... Args> struct is_constructible;
template <class T> struct is_default_constructible;
@ -236,10 +237,10 @@ struct _LIBCPP_TYPE_VIS_ONLY integral_constant
typedef _Tp value_type;
typedef integral_constant type;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR operator value_type() const {return value;}
_LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;}
#if _LIBCPP_STD_VER > 11
_LIBCPP_INLINE_VISIBILITY
constexpr value_type operator ()() const {return value;}
constexpr value_type operator ()() const _NOEXCEPT {return value;}
#endif
};
@ -285,11 +286,11 @@ template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type;
// is_void
template <class _Tp> struct __is_void : public false_type {};
template <> struct __is_void<void> : public true_type {};
template <class _Tp> struct __libcpp_is_void : public false_type {};
template <> struct __libcpp_is_void<void> : public true_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void
: public __is_void<typename remove_cv<_Tp>::type> {};
: public __libcpp_is_void<typename remove_cv<_Tp>::type> {};
// __is_nullptr_t
@ -306,37 +307,41 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer
// is_integral
template <class _Tp> struct __is_integral : public false_type {};
template <> struct __is_integral<bool> : public true_type {};
template <> struct __is_integral<char> : public true_type {};
template <> struct __is_integral<signed char> : public true_type {};
template <> struct __is_integral<unsigned char> : public true_type {};
template <> struct __is_integral<wchar_t> : public true_type {};
template <class _Tp> struct __libcpp_is_integral : public false_type {};
template <> struct __libcpp_is_integral<bool> : public true_type {};
template <> struct __libcpp_is_integral<char> : public true_type {};
template <> struct __libcpp_is_integral<signed char> : public true_type {};
template <> struct __libcpp_is_integral<unsigned char> : public true_type {};
template <> struct __libcpp_is_integral<wchar_t> : public true_type {};
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
template <> struct __is_integral<char16_t> : public true_type {};
template <> struct __is_integral<char32_t> : public true_type {};
template <> struct __libcpp_is_integral<char16_t> : public true_type {};
template <> struct __libcpp_is_integral<char32_t> : public true_type {};
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
template <> struct __is_integral<short> : public true_type {};
template <> struct __is_integral<unsigned short> : public true_type {};
template <> struct __is_integral<int> : public true_type {};
template <> struct __is_integral<unsigned int> : public true_type {};
template <> struct __is_integral<long> : public true_type {};
template <> struct __is_integral<unsigned long> : public true_type {};
template <> struct __is_integral<long long> : public true_type {};
template <> struct __is_integral<unsigned long long> : public true_type {};
template <> struct __libcpp_is_integral<short> : public true_type {};
template <> struct __libcpp_is_integral<unsigned short> : public true_type {};
template <> struct __libcpp_is_integral<int> : public true_type {};
template <> struct __libcpp_is_integral<unsigned int> : public true_type {};
template <> struct __libcpp_is_integral<long> : public true_type {};
template <> struct __libcpp_is_integral<unsigned long> : public true_type {};
template <> struct __libcpp_is_integral<long long> : public true_type {};
template <> struct __libcpp_is_integral<unsigned long long> : public true_type {};
#ifndef _LIBCPP_HAS_NO_INT128
template <> struct __libcpp_is_integral<__int128_t> : public true_type {};
template <> struct __libcpp_is_integral<__uint128_t> : public true_type {};
#endif
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral
: public __is_integral<typename remove_cv<_Tp>::type> {};
: public __libcpp_is_integral<typename remove_cv<_Tp>::type> {};
// is_floating_point
template <class _Tp> struct __is_floating_point : public false_type {};
template <> struct __is_floating_point<float> : public true_type {};
template <> struct __is_floating_point<double> : public true_type {};
template <> struct __is_floating_point<long double> : public true_type {};
template <class _Tp> struct __libcpp_is_floating_point : public false_type {};
template <> struct __libcpp_is_floating_point<float> : public true_type {};
template <> struct __libcpp_is_floating_point<double> : public true_type {};
template <> struct __libcpp_is_floating_point<long double> : public true_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point
: public __is_floating_point<typename remove_cv<_Tp>::type> {};
: public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {};
// is_array
@ -349,11 +354,11 @@ template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]>
// is_pointer
template <class _Tp> struct __is_pointer : public false_type {};
template <class _Tp> struct __is_pointer<_Tp*> : public true_type {};
template <class _Tp> struct __libcpp_is_pointer : public false_type {};
template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer
: public __is_pointer<typename remove_cv<_Tp>::type> {};
: public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {};
// is_reference
@ -417,7 +422,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> :
// is_function
namespace __is_function_imp
namespace __libcpp_is_function_imp
{
template <class _Tp> char __test(_Tp*);
template <class _Tp> __two __test(...);
@ -429,29 +434,29 @@ template <class _Tp, bool = is_class<_Tp>::value ||
is_void<_Tp>::value ||
is_reference<_Tp>::value ||
__is_nullptr_t<_Tp>::value >
struct __is_function
: public integral_constant<bool, sizeof(__is_function_imp::__test<_Tp>(__is_function_imp::__source<_Tp>())) == 1>
struct __libcpp_is_function
: public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>())) == 1>
{};
template <class _Tp> struct __is_function<_Tp, true> : public false_type {};
template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function
: public __is_function<_Tp> {};
: public __libcpp_is_function<_Tp> {};
// is_member_function_pointer
template <class _Tp> struct __is_member_function_pointer : public false_type {};
template <class _Tp, class _Up> struct __is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {};
template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer
: public __is_member_function_pointer<typename remove_cv<_Tp>::type> {};
: public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {};
// is_member_pointer
template <class _Tp> struct __is_member_pointer : public false_type {};
template <class _Tp, class _Up> struct __is_member_pointer<_Tp _Up::*> : public true_type {};
template <class _Tp> struct __libcpp_is_member_pointer : public false_type {};
template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer
: public __is_member_pointer<typename remove_cv<_Tp>::type> {};
: public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {};
// is_member_object_pointer
@ -644,32 +649,32 @@ template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
// is_signed
template <class _Tp, bool = is_integral<_Tp>::value>
struct __is_signed_impl : public integral_constant<bool, _Tp(-1) < _Tp(0)> {};
struct __libcpp_is_signed_impl : public integral_constant<bool, _Tp(-1) < _Tp(0)> {};
template <class _Tp>
struct __is_signed_impl<_Tp, false> : public true_type {}; // floating point
struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point
template <class _Tp, bool = is_arithmetic<_Tp>::value>
struct __is_signed : public __is_signed_impl<_Tp> {};
struct __libcpp_is_signed : public __libcpp_is_signed_impl<_Tp> {};
template <class _Tp> struct __is_signed<_Tp, false> : public false_type {};
template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __is_signed<_Tp> {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {};
// is_unsigned
template <class _Tp, bool = is_integral<_Tp>::value>
struct __is_unsigned_impl : public integral_constant<bool, _Tp(0) < _Tp(-1)> {};
struct __libcpp_is_unsigned_impl : public integral_constant<bool, _Tp(0) < _Tp(-1)> {};
template <class _Tp>
struct __is_unsigned_impl<_Tp, false> : public false_type {}; // floating point
struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point
template <class _Tp, bool = is_arithmetic<_Tp>::value>
struct __is_unsigned : public __is_unsigned_impl<_Tp> {};
struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp> {};
template <class _Tp> struct __is_unsigned<_Tp, false> : public false_type {};
template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __is_unsigned<_Tp> {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {};
// rank
@ -759,6 +764,13 @@ template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {}
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {};
// is_final
#if _LIBCPP_STD_VER > 11 && __has_feature(is_final)
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
is_final : public integral_constant<bool, __is_final(_Tp)> {};
#endif
// is_base_of
#ifdef _LIBCPP_HAS_IS_BASE_OF
@ -946,7 +958,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_emp
// is_polymorphic
#if __has_feature(is_polymorphic)
#if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC)
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic
@ -1239,7 +1251,13 @@ typedef
__type_list<signed int,
__type_list<signed long,
__type_list<signed long long,
#ifndef _LIBCPP_HAS_NO_INT128
__type_list<__int128_t,
#endif
__nat
#ifndef _LIBCPP_HAS_NO_INT128
>
#endif
> > > > > __signed_types;
typedef
@ -1248,7 +1266,13 @@ typedef
__type_list<unsigned int,
__type_list<unsigned long,
__type_list<unsigned long long,
#ifndef _LIBCPP_HAS_NO_INT128
__type_list<__uint128_t,
#endif
__nat
#ifndef _LIBCPP_HAS_NO_INT128
>
#endif
> > > > > __unsigned_types;
template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first;
@ -1332,6 +1356,10 @@ template <> struct __make_signed< signed long, true> {typedef long ty
template <> struct __make_signed<unsigned long, true> {typedef long type;};
template <> struct __make_signed< signed long long, true> {typedef long long type;};
template <> struct __make_signed<unsigned long long, true> {typedef long long type;};
#ifndef _LIBCPP_HAS_NO_INT128
template <> struct __make_signed<__int128_t, true> {typedef __int128_t type;};
template <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;};
#endif
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY make_signed
@ -1361,6 +1389,10 @@ template <> struct __make_unsigned< signed long, true> {typedef unsigned l
template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;};
template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;};
template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;};
#ifndef _LIBCPP_HAS_NO_INT128
template <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;};
template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;};
#endif
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY make_unsigned
@ -1385,7 +1417,7 @@ template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, void, void>
{
public:
typedef _Tp type;
typedef typename decay<_Tp>::type type;
};
template <class _Tp, class _Up>
@ -2002,10 +2034,24 @@ class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)>
#endif // _LIBCPP_HAS_NO_VARIADICS
#ifndef _LIBCPP_HAS_NO_VARIADICS
// template <class T, class... Args> struct is_constructible;
namespace __is_construct
{
struct __nat {};
}
#if __has_feature(is_constructible)
template <class _Tp, class ..._Args>
struct _LIBCPP_TYPE_VIS_ONLY is_constructible
: public integral_constant<bool, __is_constructible(_Tp, _Args...)>
{};
#else
#ifndef _LIBCPP_HAS_NO_VARIADICS
// main is_constructible test
template <class _Tp, class ..._Args>
@ -2017,7 +2063,7 @@ false_type
__is_constructible_test(__any, _Args&& ...);
template <bool, class _Tp, class... _Args>
struct __is_constructible // false, _Tp is not a scalar
struct __libcpp_is_constructible // false, _Tp is not a scalar
: public common_type
<
decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...))
@ -2027,7 +2073,7 @@ struct __is_constructible // false, _Tp is not a scalar
// function types are not constructible
template <class _Rp, class... _A1, class... _A2>
struct __is_constructible<false, _Rp(_A1...), _A2...>
struct __libcpp_is_constructible<false, _Rp(_A1...), _A2...>
: public false_type
{};
@ -2036,7 +2082,7 @@ struct __is_constructible<false, _Rp(_A1...), _A2...>
// Scalars are default constructible, references are not
template <class _Tp>
struct __is_constructible<true, _Tp>
struct __libcpp_is_constructible<true, _Tp>
: public is_scalar<_Tp>
{};
@ -2051,7 +2097,7 @@ struct __is_constructible_ref
};
template <class _Tp, class _A0>
struct __is_constructible<true, _Tp, _A0>
struct __libcpp_is_constructible<true, _Tp, _A0>
: public common_type
<
decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>()))
@ -2061,7 +2107,7 @@ struct __is_constructible<true, _Tp, _A0>
// Scalars and references are not constructible from multiple args.
template <class _Tp, class _A0, class ..._Args>
struct __is_constructible<true, _Tp, _A0, _Args...>
struct __libcpp_is_constructible<true, _Tp, _A0, _Args...>
: public false_type
{};
@ -2069,7 +2115,7 @@ struct __is_constructible<true, _Tp, _A0, _Args...>
template <bool, class _Tp, class... _Args>
struct __is_constructible_void_check
: public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
: public __libcpp_is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
_Tp, _Args...>
{};
@ -2104,21 +2150,21 @@ struct _LIBCPP_TYPE_VIS_ONLY is_constructible
// is default constructible
template <class _Ap, size_t _Np>
struct __is_constructible<false, _Ap[_Np]>
struct __libcpp_is_constructible<false, _Ap[_Np]>
: public is_constructible<typename remove_all_extents<_Ap>::type>
{};
// Otherwise array types are not constructible by this syntax
template <class _Ap, size_t _Np, class ..._Args>
struct __is_constructible<false, _Ap[_Np], _Args...>
struct __libcpp_is_constructible<false, _Ap[_Np], _Args...>
: public false_type
{};
// Incomplete array types are not constructible
template <class _Ap, class ..._Args>
struct __is_constructible<false, _Ap[], _Args...>
struct __libcpp_is_constructible<false, _Ap[], _Args...>
: public false_type
{};
@ -2233,13 +2279,6 @@ struct __is_constructible2_void_check<true, _Tp, _A0, _A1>
// is_constructible entry point
namespace __is_construct
{
struct __nat {};
}
template <class _Tp, class _A0 = __is_construct::__nat,
class _A1 = __is_construct::__nat>
struct _LIBCPP_TYPE_VIS_ONLY is_constructible
@ -2304,6 +2343,7 @@ struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
{};
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // __has_feature(is_constructible)
// is_default_constructible
@ -2559,29 +2599,29 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
#if __has_feature(cxx_noexcept)
template <bool, class _Tp, class... _Args> struct __is_nothrow_constructible;
template <bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
template <class _Tp, class... _Args>
struct __is_nothrow_constructible<true, _Tp, _Args...>
struct __libcpp_is_nothrow_constructible<true, _Tp, _Args...>
: public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
{
};
template <class _Tp, class... _Args>
struct __is_nothrow_constructible<false, _Tp, _Args...>
struct __libcpp_is_nothrow_constructible<false, _Tp, _Args...>
: public false_type
{
};
template <class _Tp, class... _Args>
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
: __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
: __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
{
};
template <class _Tp, size_t _Ns>
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]>
: __is_nothrow_constructible<is_constructible<_Tp>::value, _Tp>
: __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, _Tp>
{
};
@ -2720,23 +2760,23 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible
#if __has_feature(cxx_noexcept)
template <bool, class _Tp, class _Arg> struct __is_nothrow_assignable;
template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable;
template <class _Tp, class _Arg>
struct __is_nothrow_assignable<false, _Tp, _Arg>
struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg>
: public false_type
{
};
template <class _Tp, class _Arg>
struct __is_nothrow_assignable<true, _Tp, _Arg>
struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg>
: public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) >
{
};
template <class _Tp, class _Arg>
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable
: public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
: public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
{
};
@ -2806,23 +2846,23 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable
#if __has_feature(cxx_noexcept)
template <bool, class _Tp> struct __is_nothrow_destructible;
template <bool, class _Tp> struct __libcpp_is_nothrow_destructible;
template <class _Tp>
struct __is_nothrow_destructible<false, _Tp>
struct __libcpp_is_nothrow_destructible<false, _Tp>
: public false_type
{
};
template <class _Tp>
struct __is_nothrow_destructible<true, _Tp>
struct __libcpp_is_nothrow_destructible<true, _Tp>
: public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) >
{
};
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible
: public __is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
: public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
{
};
@ -3079,7 +3119,7 @@ template <class _Fp, class _A0, class ..._Args,
class = typename enable_if
<
is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
is_base_of<typename remove_reference<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType>::type,
typename remove_reference<_A0>::type>::value
>::type
>
@ -3092,7 +3132,7 @@ template <class _Fp, class _A0, class ..._Args,
class = typename enable_if
<
is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
!is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
!is_base_of<typename remove_reference<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType>::type,
typename remove_reference<_A0>::type>::value
>::type
>

View File

@ -60,6 +60,7 @@ public:
#include <__config>
#include <exception>
#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@ -73,32 +74,75 @@ class _LIBCPP_EXCEPTION_ABI type_info
type_info& operator=(const type_info&);
type_info(const type_info&);
protected:
#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
const char* __type_name;
#else
// A const char* with the non-unique RTTI bit possibly set.
uintptr_t __type_name;
#endif
_LIBCPP_INLINE_VISIBILITY
explicit type_info(const char* __n)
#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
: __type_name(__n) {}
#else
: __type_name(reinterpret_cast<uintptr_t>(__n)) {}
#endif
public:
virtual ~type_info();
_LIBCPP_INLINE_VISIBILITY
const char* name() const _NOEXCEPT {return __type_name;}
const char* name() const _NOEXCEPT
#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
{return __type_name;}
#else
{return reinterpret_cast<const char*>(__type_name & ~_LIBCPP_NONUNIQUE_RTTI_BIT);}
#endif
_LIBCPP_INLINE_VISIBILITY
bool before(const type_info& __arg) const _NOEXCEPT
#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
{return __type_name < __arg.__type_name;}
#else
{if (!((__type_name & __arg.__type_name) & _LIBCPP_NONUNIQUE_RTTI_BIT))
return __type_name < __arg.__type_name;
return __compare_nonunique_names(__arg) < 0;}
#endif
_LIBCPP_INLINE_VISIBILITY
size_t hash_code() const _NOEXCEPT
#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
{return *reinterpret_cast<const size_t*>(&__type_name);}
#else
{if (!(__type_name & _LIBCPP_NONUNIQUE_RTTI_BIT)) return __type_name;
const char *__ptr = name();
size_t __hash = 5381;
while (unsigned char __c = static_cast<unsigned char>(*__ptr++))
__hash = (__hash * 33) ^ __c;
return __hash;}
#endif
_LIBCPP_INLINE_VISIBILITY
bool operator==(const type_info& __arg) const _NOEXCEPT
#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
{return __type_name == __arg.__type_name;}
#else
{if (__type_name == __arg.__type_name) return true;
if (!((__type_name & __arg.__type_name) & _LIBCPP_NONUNIQUE_RTTI_BIT))
return false;
return __compare_nonunique_names(__arg) == 0;}
#endif
_LIBCPP_INLINE_VISIBILITY
bool operator!=(const type_info& __arg) const _NOEXCEPT
{return !operator==(__arg);}
#ifdef _LIBCPP_NONUNIQUE_RTTI_BIT
private:
_LIBCPP_INLINE_VISIBILITY
int __compare_nonunique_names(const type_info &__arg) const _NOEXCEPT
{return __builtin_strcmp(name(), __arg.name());}
#endif
};
class _LIBCPP_EXCEPTION_ABI bad_cast

View File

@ -831,12 +831,14 @@ public:
#if __cplusplus >= 201103L
__table_ = __u.__table_;
#else
__table_.clear();
__table_.hash_function() = __u.__table_.hash_function();
__table_.key_eq() = __u.__table_.key_eq();
__table_.max_load_factor() = __u.__table_.max_load_factor();
__table_.__copy_assign_alloc(__u.__table_);
insert(__u.begin(), __u.end());
if (this != &__u) {
__table_.clear();
__table_.hash_function() = __u.__table_.hash_function();
__table_.key_eq() = __u.__table_.key_eq();
__table_.max_load_factor() = __u.__table_.max_load_factor();
__table_.__copy_assign_alloc(__u.__table_);
insert(__u.begin(), __u.end());
}
#endif
return *this;
}
@ -1567,12 +1569,14 @@ public:
#if __cplusplus >= 201103L
__table_ = __u.__table_;
#else
__table_.clear();
__table_.hash_function() = __u.__table_.hash_function();
__table_.key_eq() = __u.__table_.key_eq();
__table_.max_load_factor() = __u.__table_.max_load_factor();
__table_.__copy_assign_alloc(__u.__table_);
insert(__u.begin(), __u.end());
if (this != &__u) {
__table_.clear();
__table_.hash_function() = __u.__table_.hash_function();
__table_.key_eq() = __u.__table_.key_eq();
__table_.max_load_factor() = __u.__table_.max_load_factor();
__table_.__copy_assign_alloc(__u.__table_);
insert(__u.begin(), __u.end());
}
#endif
return *this;
}

View File

@ -101,30 +101,30 @@ constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
template <class T> class tuple_size;
template <size_t I, class T> class tuple_element;
template <class T1, class T2> struct tuple_size<std::pair<T1, T2> >;
template <class T1, class T2> struct tuple_element<0, std::pair<T1, T2> >;
template <class T1, class T2> struct tuple_element<1, std::pair<T1, T2> >;
template <class T1, class T2> struct tuple_size<pair<T1, T2> >;
template <class T1, class T2> struct tuple_element<0, pair<T1, T2> >;
template <class T1, class T2> struct tuple_element<1, pair<T1, T2> >;
template<size_t I, class T1, class T2>
typename tuple_element<I, std::pair<T1, T2> >::type&
get(std::pair<T1, T2>&) noexcept; // constexpr in C++14
typename tuple_element<I, pair<T1, T2> >::type&
get(pair<T1, T2>&) noexcept; // constexpr in C++14
template<size_t I, class T1, class T2>
const typename const tuple_element<I, std::pair<T1, T2> >::type&
get(const std::pair<T1, T2>&) noexcept; // constexpr in C++14
const typename const tuple_element<I, pair<T1, T2> >::type&
get(const pair<T1, T2>&) noexcept; // constexpr in C++14
template<size_t I, class T1, class T2>
typename tuple_element<I, std::pair<T1, T2> >::type&&
get(std::pair<T1, T2>&&) noexcept; // constexpr in C++14
typename tuple_element<I, pair<T1, T2> >::type&&
get(pair<T1, T2>&&) noexcept; // constexpr in C++14
template<class T1, class T2>
constexpr T1& get(std::pair<T1, T2>&) noexcept; // C++14
constexpr T1& get(pair<T1, T2>&) noexcept; // C++14
template<size_t I, class T1, class T2>
constexpr T1 const& get(std::pair<T1, T2> const &) noexcept; // C++14
constexpr T1 const& get(pair<T1, T2> const &) noexcept; // C++14
template<size_t I, class T1, class T2>
constexpr T1&& get(std::pair<T1, T2>&&) noexcept; // C++14
constexpr T1&& get(pair<T1, T2>&&) noexcept; // C++14
// C++14

View File

@ -483,6 +483,7 @@ class _LIBCPP_TYPE_VIS_ONLY vector
{
private:
typedef __vector_base<_Tp, _Allocator> __base;
typedef allocator<_Tp> __default_allocator_type;
public:
typedef vector __self;
typedef _Tp value_type;
@ -749,7 +750,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT
{
size_type __old_size = size();
__base::clear();
__annotate_shrink(__old_size);
__invalidate_all_iterators();
}
@ -816,7 +819,9 @@ private:
}
__get_db()->unlock();
#endif
size_type __old_size = size();
__base::__destruct_at_end(__new_last);
__annotate_shrink(__old_size);
}
template <class _Up>
void
@ -830,17 +835,52 @@ private:
void
__emplace_back_slow_path(_Args&&... __args);
#endif
// The following functions are no-ops outside of AddressSanitizer mode.
// We call annotatations only for the default Allocator because other allocators
// may not meet the AddressSanitizer alignment constraints.
// See the documentation for __sanitizer_annotate_contiguous_container for more details.
void __annotate_contiguous_container
(const void *__beg, const void *__end, const void *__old_mid, const void *__new_mid)
{
#ifndef _LIBCPP_HAS_NO_ASAN
if (__beg && is_same<allocator_type, __default_allocator_type>::value)
__sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid);
#endif
}
void __annotate_new(size_type __current_size)
{
__annotate_contiguous_container(data(), data() + capacity(),
data() + capacity(), data() + __current_size);
}
void __annotate_delete()
{
__annotate_contiguous_container(data(), data() + capacity(),
data() + size(), data() + capacity());
}
void __annotate_increase(size_type __n)
{
__annotate_contiguous_container(data(), data() + capacity(),
data() + size(), data() + size() + __n);
}
void __annotate_shrink(size_type __old_size)
{
__annotate_contiguous_container(data(), data() + capacity(),
data() + __old_size, data() + size());
}
};
template <class _Tp, class _Allocator>
void
vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v)
{
__annotate_delete();
__alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_);
_VSTD::swap(this->__begin_, __v.__begin_);
_VSTD::swap(this->__end_, __v.__end_);
_VSTD::swap(this->__end_cap(), __v.__end_cap());
__v.__first_ = __v.__begin_;
__annotate_new(size());
__invalidate_all_iterators();
}
@ -848,6 +888,7 @@ template <class _Tp, class _Allocator>
typename vector<_Tp, _Allocator>::pointer
vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p)
{
__annotate_delete();
pointer __r = __v.__begin_;
__alloc_traits::__construct_backward(this->__alloc(), this->__begin_, __p, __v.__begin_);
__alloc_traits::__construct_forward(this->__alloc(), __p, this->__end_, __v.__end_);
@ -855,6 +896,7 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
_VSTD::swap(this->__end_, __v.__end_);
_VSTD::swap(this->__end_cap(), __v.__end_cap());
__v.__first_ = __v.__begin_;
__annotate_new(size());
__invalidate_all_iterators();
return __r;
}
@ -874,6 +916,7 @@ vector<_Tp, _Allocator>::allocate(size_type __n)
this->__throw_length_error();
this->__begin_ = this->__end_ = __alloc_traits::allocate(this->__alloc(), __n);
this->__end_cap() = this->__begin_ + __n;
__annotate_new(0);
}
template <class _Tp, class _Allocator>
@ -920,6 +963,7 @@ void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
{
allocator_type& __a = this->__alloc();
__annotate_increase(__n);
do
{
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
@ -940,6 +984,7 @@ void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
allocator_type& __a = this->__alloc();
__annotate_increase(__n);
do
{
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
@ -960,6 +1005,7 @@ vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIt
allocator_type& __a = this->__alloc();
for (; __first != __last; ++__first)
{
__annotate_increase(1);
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
++this->__end_;
}
@ -972,6 +1018,7 @@ vector<_Tp, _Allocator>::__move_construct_at_end(pointer __first, pointer __last
allocator_type& __a = this->__alloc();
for (; __first != __last; ++__first)
{
__annotate_increase(1);
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
_VSTD::move(*__first));
++this->__end_;
@ -1535,6 +1582,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x)
{
if (this->__end_ != this->__end_cap())
{
__annotate_increase(1);
__alloc_traits::construct(this->__alloc(),
_VSTD::__to_raw_pointer(this->__end_), __x);
++this->__end_;
@ -1552,6 +1600,7 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x)
{
if (this->__end_ < this->__end_cap())
{
__annotate_increase(1);
__alloc_traits::construct(this->__alloc(),
_VSTD::__to_raw_pointer(this->__end_),
_VSTD::move(__x));
@ -1584,6 +1633,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{
if (this->__end_ < this->__end_cap())
{
__annotate_increase(1);
__alloc_traits::construct(this->__alloc(),
_VSTD::__to_raw_pointer(this->__end_),
_VSTD::forward<_Args>(__args)...);
@ -1666,6 +1716,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
pointer __p = this->__begin_ + (__position - begin());
if (this->__end_ < this->__end_cap())
{
__annotate_increase(1);
if (__p == this->__end_)
{
__alloc_traits::construct(this->__alloc(),
@ -1705,6 +1756,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
pointer __p = this->__begin_ + (__position - begin());
if (this->__end_ < this->__end_cap())
{
__annotate_increase(1);
if (__p == this->__end_)
{
__alloc_traits::construct(this->__alloc(),
@ -1743,6 +1795,7 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
pointer __p = this->__begin_ + (__position - begin());
if (this->__end_ < this->__end_cap())
{
__annotate_increase(1);
if (__p == this->__end_)
{
__alloc_traits::construct(this->__alloc(),
@ -1794,6 +1847,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_
}
if (__n > 0)
{
__annotate_increase(__n);
__move_range(__p, __old_last, __p + __old_n);
const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
if (__p <= __xr && __xr < this->__end_)
@ -1904,6 +1958,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi
}
if (__n > 0)
{
__annotate_increase(__n);
__move_range(__p, __old_last, __p + __old_n);
_VSTD::copy(__first, __m, __p);
}

View File

@ -32,7 +32,7 @@ condition_variable::notify_all() _NOEXCEPT
}
void
condition_variable::wait(unique_lock<mutex>& lk)
condition_variable::wait(unique_lock<mutex>& lk) _NOEXCEPT
{
if (!lk.owns_lock())
__throw_system_error(EPERM,
@ -44,7 +44,7 @@ condition_variable::wait(unique_lock<mutex>& lk)
void
condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
chrono::time_point<chrono::system_clock, chrono::nanoseconds> tp)
chrono::time_point<chrono::system_clock, chrono::nanoseconds> tp) _NOEXCEPT
{
using namespace chrono;
if (!lk.owns_lock())

View File

@ -136,7 +136,7 @@ const unsigned indices[] =
// The algorithm creates a list of small primes, plus an open-ended list of
// potential primes. All prime numbers are potential prime numbers. However
// some potential prime numbers are not prime. In an ideal world, all potential
// prime numbers would be prime. Candiate prime numbers are chosen as the next
// prime numbers would be prime. Candidate prime numbers are chosen as the next
// highest potential prime. Then this number is tested for prime by dividing it
// by all potential prime numbers less than the sqrt of the candidate.
//

View File

@ -303,7 +303,7 @@ void
ios_base::copyfmt(const ios_base& rhs)
{
// If we can't acquire the needed resources, throw bad_alloc (can't set badbit)
// Don't alter *this until all needed resources are aquired
// Don't alter *this until all needed resources are acquired
unique_ptr<event_callback, void (*)(void*)> new_callbacks(0, free);
unique_ptr<int, void (*)(void*)> new_ints(0, free);
unique_ptr<long, void (*)(void*)> new_longs(0, free);

View File

@ -12,7 +12,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
shared_mutex::shared_mutex()
shared_timed_mutex::shared_timed_mutex()
: __state_(0)
{
}
@ -20,7 +20,7 @@ shared_mutex::shared_mutex()
// Exclusive ownership
void
shared_mutex::lock()
shared_timed_mutex::lock()
{
unique_lock<mutex> lk(__mut_);
while (__state_ & __write_entered_)
@ -31,7 +31,7 @@ shared_mutex::lock()
}
bool
shared_mutex::try_lock()
shared_timed_mutex::try_lock()
{
unique_lock<mutex> lk(__mut_);
if (__state_ == 0)
@ -43,7 +43,7 @@ shared_mutex::try_lock()
}
void
shared_mutex::unlock()
shared_timed_mutex::unlock()
{
lock_guard<mutex> _(__mut_);
__state_ = 0;
@ -53,7 +53,7 @@ shared_mutex::unlock()
// Shared ownership
void
shared_mutex::lock_shared()
shared_timed_mutex::lock_shared()
{
unique_lock<mutex> lk(__mut_);
while ((__state_ & __write_entered_) || (__state_ & __n_readers_) == __n_readers_)
@ -64,7 +64,7 @@ shared_mutex::lock_shared()
}
bool
shared_mutex::try_lock_shared()
shared_timed_mutex::try_lock_shared()
{
unique_lock<mutex> lk(__mut_);
unsigned num_readers = __state_ & __n_readers_;
@ -79,7 +79,7 @@ shared_mutex::try_lock_shared()
}
void
shared_mutex::unlock_shared()
shared_timed_mutex::unlock_shared()
{
lock_guard<mutex> _(__mut_);
unsigned num_readers = (__state_ & __n_readers_) - 1;

View File

@ -7,124 +7,42 @@
//
//===----------------------------------------------------------------------===//
#include "__refstring"
#include "stdexcept"
#include "new"
#include "string"
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <cstddef>
#include "system_error"
#ifndef __has_include
#define __has_include(inc) 0
#endif
#ifdef __APPLE__
#include <cxxabi.h>
#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
/* For _LIBCPPABI_VERSION */
#if __has_include(<cxxabi.h>) || defined(__APPLE_) || defined(LIBCXXRT)
#include <cxxabi.h>
#endif
// Note: optimize for size
#if ! defined(_LIBCPP_MSVC)
#pragma GCC visibility push(hidden)
#endif
namespace
{
class __libcpp_nmstr
{
private:
const char* str_;
typedef std::size_t unused_t;
typedef std::ptrdiff_t count_t;
static const std::ptrdiff_t offset = static_cast<std::ptrdiff_t>(2*sizeof(unused_t) +
sizeof(count_t));
count_t& count() const _NOEXCEPT {return *const_cast<count_t *>(reinterpret_cast<const count_t *>(str_ - sizeof(count_t)));}
public:
explicit __libcpp_nmstr(const char* msg);
__libcpp_nmstr(const __libcpp_nmstr& s) _NOEXCEPT;
__libcpp_nmstr& operator=(const __libcpp_nmstr& s) _NOEXCEPT;
~__libcpp_nmstr();
const char* c_str() const _NOEXCEPT {return str_;}
};
__libcpp_nmstr::__libcpp_nmstr(const char* msg)
{
std::size_t len = strlen(msg);
str_ = new char[len + 1 + offset];
unused_t* c = reinterpret_cast<unused_t*>(const_cast<char *>(str_));
c[0] = c[1] = len;
str_ += offset;
count() = 0;
std::memcpy(const_cast<char*>(c_str()), msg, len + 1);
}
inline
__libcpp_nmstr::__libcpp_nmstr(const __libcpp_nmstr& s) _NOEXCEPT
: str_(s.str_)
{
__sync_add_and_fetch(&count(), 1);
}
__libcpp_nmstr&
__libcpp_nmstr::operator=(const __libcpp_nmstr& s) _NOEXCEPT
{
const char* p = str_;
str_ = s.str_;
__sync_add_and_fetch(&count(), 1);
if (__sync_add_and_fetch(reinterpret_cast<const count_t*>(p-sizeof(count_t)), count_t(-1)) < 0)
delete [] (p-offset);
return *this;
}
inline
__libcpp_nmstr::~__libcpp_nmstr()
{
if (__sync_add_and_fetch(&count(), count_t(-1)) < 0)
delete [] (str_ - offset);
}
}
#if ! defined(_LIBCPP_MSVC)
#pragma GCC visibility pop
#endif
static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char *), "");
namespace std // purposefully not using versioning namespace
{
logic_error::logic_error(const string& msg)
logic_error::logic_error(const string& msg) : __imp_(msg.c_str())
{
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
::new(s) __libcpp_nmstr(msg.c_str());
}
logic_error::logic_error(const char* msg)
logic_error::logic_error(const char* msg) : __imp_(msg)
{
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
::new(s) __libcpp_nmstr(msg);
}
logic_error::logic_error(const logic_error& le) _NOEXCEPT
logic_error::logic_error(const logic_error& le) _NOEXCEPT : __imp_(le.__imp_)
{
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
::new(s) __libcpp_nmstr(*s2);
}
logic_error&
logic_error::operator=(const logic_error& le) _NOEXCEPT
{
__libcpp_nmstr *s1 = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
*s1 = *s2;
__imp_ = le.__imp_;
return *this;
}
@ -132,44 +50,33 @@ logic_error::operator=(const logic_error& le) _NOEXCEPT
logic_error::~logic_error() _NOEXCEPT
{
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
s->~__libcpp_nmstr();
}
const char*
logic_error::what() const _NOEXCEPT
{
const __libcpp_nmstr *s = reinterpret_cast<const __libcpp_nmstr *>(&__imp_);
return s->c_str();
return __imp_.c_str();
}
#endif
runtime_error::runtime_error(const string& msg)
runtime_error::runtime_error(const string& msg) : __imp_(msg.c_str())
{
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
::new(s) __libcpp_nmstr(msg.c_str());
}
runtime_error::runtime_error(const char* msg)
runtime_error::runtime_error(const char* msg) : __imp_(msg)
{
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
::new(s) __libcpp_nmstr(msg);
}
runtime_error::runtime_error(const runtime_error& le) _NOEXCEPT
: __imp_(le.__imp_)
{
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
::new(s) __libcpp_nmstr(*s2);
}
runtime_error&
runtime_error::operator=(const runtime_error& le) _NOEXCEPT
{
__libcpp_nmstr *s1 = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
*s1 = *s2;
__imp_ = le.__imp_;
return *this;
}
@ -177,15 +84,12 @@ runtime_error::operator=(const runtime_error& le) _NOEXCEPT
runtime_error::~runtime_error() _NOEXCEPT
{
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
s->~__libcpp_nmstr();
}
const char*
runtime_error::what() const _NOEXCEPT
{
const __libcpp_nmstr *s = reinterpret_cast<const __libcpp_nmstr *>(&__imp_);
return s->c_str();
return __imp_.c_str();
}
domain_error::~domain_error() _NOEXCEPT {}

View File

@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
#define _LIBCPP_BUILDING_SYSTEM_ERROR
#define _LIBCPP_BUILDING_SYSTEM_ERROR
#include "system_error"
#include "string"
#include "cstring"

View File

@ -43,4 +43,12 @@ int main()
test(x, y, x);
test(y, x, x);
}
#if _LIBCPP_STD_VER > 11
{
constexpr int x = 1;
constexpr int y = 0;
static_assert(std::max(x, y) == x, "" );
static_assert(std::max(y, x) == x, "" );
}
#endif
}

View File

@ -45,4 +45,12 @@ int main()
test(x, y, std::greater<int>(), y);
test(y, x, std::greater<int>(), y);
}
#if _LIBCPP_STD_VER > 11
{
constexpr int x = 1;
constexpr int y = 0;
static_assert(std::max(x, y, std::greater<int>()) == y, "" );
static_assert(std::max(y, x, std::greater<int>()) == y, "" );
}
#endif
}

View File

@ -58,10 +58,28 @@ test()
test<Iter>(1000);
}
template <class Iter, class Pred>
void test_eq0(Iter first, Iter last, Pred p)
{
assert(first == std::max_element(first, last, p));
}
void test_eq()
{
const size_t N = 10;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 10; // all the same
test_eq0(a, a+N, std::less<int>());
test_eq0(a, a+N, std::greater<int>());
delete [] a;
}
int main()
{
test<forward_iterator<const int*> >();
test<bidirectional_iterator<const int*> >();
test<random_access_iterator<const int*> >();
test<const int*>();
test_eq();
}

View File

@ -31,5 +31,12 @@ int main()
assert(i == 3);
i = std::max({1, 3, 2});
assert(i == 3);
#if _LIBCPP_STD_VER > 11
{
static_assert(std::max({1, 3, 2}) == 3, "");
static_assert(std::max({2, 1, 3}) == 3, "");
static_assert(std::max({3, 2, 1}) == 3, "");
}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}

View File

@ -32,5 +32,12 @@ int main()
assert(i == 1);
i = std::max({1, 3, 2}, std::greater<int>());
assert(i == 1);
#if _LIBCPP_STD_VER > 11
{
static_assert(std::max({1, 3, 2}, std::greater<int>()) == 1, "");
static_assert(std::max({2, 1, 3}, std::greater<int>()) == 1, "");
static_assert(std::max({3, 2, 1}, std::greater<int>()) == 1, "");
}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}

View File

@ -43,4 +43,12 @@ int main()
test(x, y, y);
test(y, x, y);
}
#if _LIBCPP_STD_VER > 11
{
constexpr int x = 1;
constexpr int y = 0;
static_assert(std::min(x, y) == y, "" );
static_assert(std::min(y, x) == y, "" );
}
#endif
}

View File

@ -45,4 +45,12 @@ int main()
test(x, y, std::greater<int>(), x);
test(y, x, std::greater<int>(), x);
}
#if _LIBCPP_STD_VER > 11
{
constexpr int x = 1;
constexpr int y = 0;
static_assert(std::min(x, y, std::greater<int>()) == x, "" );
static_assert(std::min(y, x, std::greater<int>()) == x, "" );
}
#endif
}

View File

@ -58,10 +58,28 @@ test()
test<Iter>(1000);
}
template <class Iter, class Pred>
void test_eq0(Iter first, Iter last, Pred p)
{
assert(first == std::min_element(first, last, p));
}
void test_eq()
{
const size_t N = 10;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 10; // all the same
test_eq0(a, a+N, std::less<int>());
test_eq0(a, a+N, std::greater<int>());
delete [] a;
}
int main()
{
test<forward_iterator<const int*> >();
test<bidirectional_iterator<const int*> >();
test<random_access_iterator<const int*> >();
test<const int*>();
test_eq();
}

View File

@ -31,5 +31,12 @@ int main()
assert(i == 1);
i = std::min({1, 3, 2});
assert(i == 1);
#if _LIBCPP_STD_VER > 11
{
static_assert(std::min({1, 3, 2}) == 1, "");
static_assert(std::min({2, 1, 3}) == 1, "");
static_assert(std::min({3, 2, 1}) == 1, "");
}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}

View File

@ -32,5 +32,12 @@ int main()
assert(i == 3);
i = std::min({1, 3, 2}, std::greater<int>());
assert(i == 3);
#if _LIBCPP_STD_VER > 11
{
static_assert(std::min({1, 3, 2}, std::greater<int>()) == 3, "");
static_assert(std::min({2, 1, 3}, std::greater<int>()) == 3, "");
static_assert(std::min({3, 2, 1}, std::greater<int>()) == 3, "");
}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}

View File

@ -45,4 +45,18 @@ int main()
test(x, y, y, x);
test(y, x, y, x);
}
#if _LIBCPP_STD_VER > 11
{
// Note that you can't take a reference to a local var, since
// it's address is not a compile-time constant.
constexpr static int x = 1;
constexpr static int y = 0;
constexpr auto p1 = std::minmax (x, y);
static_assert(p1.first == y, "");
static_assert(p1.second == x, "");
constexpr auto p2 = std::minmax (y, x);
static_assert(p2.first == y, "");
static_assert(p2.second == x, "");
}
#endif
}

View File

@ -27,6 +27,7 @@ test(const T& a, const T& b, C c, const T& x, const T& y)
assert(&p.second == &y);
}
int main()
{
{
@ -47,4 +48,18 @@ int main()
test(x, y, std::greater<int>(), x, y);
test(y, x, std::greater<int>(), x, y);
}
#if _LIBCPP_STD_VER > 11
{
// Note that you can't take a reference to a local var, since
// it's address is not a compile-time constant.
constexpr static int x = 1;
constexpr static int y = 0;
constexpr auto p1 = std::minmax(x, y, std::greater<>());
static_assert(p1.first == x, "");
static_assert(p1.second == y, "");
constexpr auto p2 = std::minmax(y, x, std::greater<>());
static_assert(p2.first == x, "");
static_assert(p2.second == y, "");
}
#endif
}

View File

@ -25,5 +25,15 @@ int main()
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)));
#if _LIBCPP_STD_VER > 11
{
static_assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)), "");
static_assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)), "");
static_assert((std::minmax({2, 1, 3}) == std::pair<int, int>(1, 3)), "");
static_assert((std::minmax({2, 3, 1}) == std::pair<int, int>(1, 3)), "");
static_assert((std::minmax({3, 1, 2}) == std::pair<int, int>(1, 3)), "");
static_assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)), "");
}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}

View File

@ -26,5 +26,15 @@ int main()
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)));
#if _LIBCPP_STD_VER > 11
{
static_assert((std::minmax({1, 2, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
static_assert((std::minmax({1, 3, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
static_assert((std::minmax({2, 1, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
static_assert((std::minmax({2, 3, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
static_assert((std::minmax({3, 1, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
static_assert((std::minmax({3, 2, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}

View File

@ -29,6 +29,7 @@ test_one(unsigned N, unsigned M)
std::random_shuffle(array, array+N);
std::nth_element(array, array+M, array+N);
assert(array[M] == M);
std::nth_element(array, array+N, array+N); // begin, end, end
delete [] array;
}

View File

@ -42,6 +42,7 @@ test_one(unsigned N, unsigned M)
std::random_shuffle(array, array+N);
std::nth_element(array, array+M, array+N, std::greater<int>());
assert(array[M] == N-M-1);
std::nth_element(array, array+N, array+N, std::greater<int>()); // begin, end, end
delete [] array;
}

View File

@ -1,3 +1,12 @@
//===----------------------------------------------------------------------===//
//
// 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 COPYABLE_H
#define COPYABLE_H

View File

@ -1,3 +1,12 @@
//===----------------------------------------------------------------------===//
//
// 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 EMPLACEABLE_H
#define EMPLACEABLE_H

View File

@ -1,3 +1,12 @@
//===----------------------------------------------------------------------===//
//
// 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 MOVEONLY_H
#define MOVEONLY_H

View File

@ -1,3 +1,12 @@
//===----------------------------------------------------------------------===//
//
// 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 NOTCONSTRUCTIBLE_H
#define NOTCONSTRUCTIBLE_H

View File

@ -215,10 +215,13 @@ int main()
C::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
}
#endif
}

View File

@ -57,6 +57,21 @@ int main()
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
}
{
typedef std::pair<const int, double> V;
const V ar[] =
{
V(1, 1),
V(2, 1),
V(3, 1),
};
std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
std::map<int, double> *p = &m;
m = *p;
assert(m.size() == 3);
assert(std::equal(m.begin(), m.end(), ar));
}
{
typedef std::pair<const int, double> V;
V ar[] =

View File

@ -31,5 +31,10 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
{
std::map<int, double> m = {};
assert(m.empty());
assert(m.begin() == m.end());
}
#endif
}

View File

@ -219,10 +219,13 @@ int main()
C::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
}
#endif
}

View File

@ -48,6 +48,26 @@ int main()
assert(mo.get_allocator() == A(2));
assert(mo.key_comp() == C(5));
}
{
typedef std::pair<const int, double> V;
const V ar[] =
{
V(1, 1),
V(1, 1.5),
V(1, 2),
V(2, 1),
V(2, 1.5),
V(2, 2),
V(3, 1),
V(3, 1.5),
V(3, 2),
};
std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
std::multimap<int, double> *p = &m;
m = *p;
assert(m.size() == sizeof(ar)/sizeof(ar[0]));
assert(std::equal(m.begin(), m.end(), ar));
}
{
typedef std::pair<const int, double> V;
V ar[] =

View File

@ -31,5 +31,10 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
{
std::multimap<int, double> m = {};
assert(m.empty());
assert(m.begin() == m.end());
}
#endif
}

View File

@ -203,10 +203,13 @@ int main()
C::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
}
#endif
}

View File

@ -68,6 +68,26 @@ int main()
assert(*next(mo.begin(), 7) == 3);
assert(*next(mo.begin(), 8) == 3);
}
{
typedef int V;
const V ar[] =
{
1,
1,
1,
2,
2,
2,
3,
3,
3
};
std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
std::multiset<int> *p = &m;
m = *p;
assert(m.size() == 9);
assert(std::equal(m.begin(), m.end(), ar));
}
{
typedef int V;
V ar[] =

View File

@ -31,5 +31,10 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
{
std::multiset<int> m = {};
assert(m.empty());
assert(m.begin() == m.end());
}
#endif
}

View File

@ -199,10 +199,13 @@ int main()
C::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
}
#endif
}

View File

@ -56,6 +56,21 @@ int main()
assert(*next(mo.begin()) == 2);
assert(*next(mo.begin(), 2) == 3);
}
{
typedef int V;
const V ar[] =
{
1,
2,
3
};
std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
std::set<int> *p = &m;
m = *p;
assert(m.size() == 3);
assert(std::equal(m.begin(), m.end(), ar));
}
{
typedef int V;
V ar[] =

View File

@ -31,5 +31,10 @@ int main()
assert(m.empty());
assert(m.begin() == m.end());
}
{
std::set<int> m = {};
assert(m.empty());
assert(m.begin() == m.end());
}
#endif
}

View File

@ -13,6 +13,7 @@
#include <queue>
#include <cassert>
#include <functional>
template <class C>
C

View File

@ -13,6 +13,7 @@
#include <queue>
#include <cassert>
#include <functional>
template <class C>
C

View File

@ -13,6 +13,7 @@
#include <queue>
#include <cassert>
#include <functional>
template <class C>
C

View File

@ -14,6 +14,7 @@
#include <queue>
#include <cassert>
#include <functional>
int main()
{

View File

@ -72,10 +72,23 @@ int main()
C::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
assert (!(ii1 < cii ));
assert (!(cii < ii1 ));
assert ( (ii1 <= cii ));
assert ( (cii <= ii1 ));
assert (!(ii1 > cii ));
assert (!(cii > ii1 ));
assert ( (ii1 >= cii ));
assert ( (cii >= ii1 ));
assert (cii - ii1 == 0);
assert (ii1 - cii == 0);
C c;
assert ( c.begin() == std::begin(c));

View File

@ -24,6 +24,10 @@ test()
{
std::deque<T, Allocator> d;
assert(d.size() == 0);
#if __cplusplus >= 201103L
std::deque<T, Allocator> d1 = {};
assert(d1.size() == 0);
#endif
}
int main()

View File

@ -19,12 +19,16 @@ static bool gCopyConstructorShouldThow = false;
class CMyClass {
public: CMyClass();
public: CMyClass(int tag);
public: CMyClass(const CMyClass& iOther);
public: ~CMyClass();
private: int fMagicValue;
bool equal(const CMyClass &rhs) const
{ return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
private:
int fMagicValue;
int fTag;
private: static int kStartedConstructionMagicValue;
private: static int kFinishedConstructionMagicValue;
};
@ -34,15 +38,15 @@ int CMyClass::kStartedConstructionMagicValue = 0;
// Value for fMagicValue when the constructor has finished running
int CMyClass::kFinishedConstructionMagicValue = 12345;
CMyClass::CMyClass() :
fMagicValue(kStartedConstructionMagicValue)
CMyClass::CMyClass(int tag) :
fMagicValue(kStartedConstructionMagicValue), fTag(tag)
{
// Signal that the constructor has finished running
fMagicValue = kFinishedConstructionMagicValue;
}
CMyClass::CMyClass(const CMyClass& /*iOther*/) :
fMagicValue(kStartedConstructionMagicValue)
CMyClass::CMyClass(const CMyClass& iOther) :
fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
{
// If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
if (gCopyConstructorShouldThow) {
@ -57,17 +61,21 @@ CMyClass::~CMyClass() {
assert(fMagicValue == kFinishedConstructionMagicValue);
}
bool operator==(const CMyClass &lhs, const CMyClass &rhs) { return lhs.equal(rhs); }
int main()
{
CMyClass instance;
CMyClass instance(42);
std::deque<CMyClass> vec;
vec.push_back(instance);
std::deque<CMyClass> vec2(vec);
gCopyConstructorShouldThow = true;
try {
vec.push_back(instance);
}
catch (...) {
assert(vec==vec2);
}
}

View File

@ -19,12 +19,16 @@ static bool gCopyConstructorShouldThow = false;
class CMyClass {
public: CMyClass();
public: CMyClass(int tag);
public: CMyClass(const CMyClass& iOther);
public: ~CMyClass();
private: int fMagicValue;
bool equal(const CMyClass &rhs) const
{ return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
private:
int fMagicValue;
int fTag;
private: static int kStartedConstructionMagicValue;
private: static int kFinishedConstructionMagicValue;
};
@ -34,15 +38,15 @@ int CMyClass::kStartedConstructionMagicValue = 0;
// Value for fMagicValue when the constructor has finished running
int CMyClass::kFinishedConstructionMagicValue = 12345;
CMyClass::CMyClass() :
fMagicValue(kStartedConstructionMagicValue)
CMyClass::CMyClass(int tag) :
fMagicValue(kStartedConstructionMagicValue), fTag(tag)
{
// Signal that the constructor has finished running
fMagicValue = kFinishedConstructionMagicValue;
}
CMyClass::CMyClass(const CMyClass& /*iOther*/) :
fMagicValue(kStartedConstructionMagicValue)
CMyClass::CMyClass(const CMyClass& iOther) :
fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
{
// If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
if (gCopyConstructorShouldThow) {
@ -57,17 +61,21 @@ CMyClass::~CMyClass() {
assert(fMagicValue == kFinishedConstructionMagicValue);
}
bool operator==(const CMyClass &lhs, const CMyClass &rhs) { return lhs.equal(rhs); }
int main()
{
CMyClass instance;
CMyClass instance(42);
std::deque<CMyClass> vec;
vec.push_front(instance);
std::deque<CMyClass> vec2(vec);
gCopyConstructorShouldThow = true;
try {
vec.push_front(instance);
}
catch (...) {
assert(vec==vec2);
}
}

View File

@ -51,11 +51,24 @@ int main()
std::deque<int>::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
assert (!(ii1 < cii ));
assert (!(cii < ii1 ));
assert ( (ii1 <= cii ));
assert ( (cii <= ii1 ));
assert (!(ii1 > cii ));
assert (!(cii > ii1 ));
assert ( (ii1 >= cii ));
assert ( (cii >= ii1 ));
assert (cii - ii1 == 0);
assert (ii1 - cii == 0);
// std::deque<int> c;
// assert ( ii1 != c.cbegin());
// assert ( cii != c.begin());

View File

@ -31,5 +31,11 @@ int main()
C c;
assert(c.empty());
}
{
typedef int T;
typedef std::forward_list<T> C;
C c = {};
assert(c.empty());
}
#endif
}

View File

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

View File

@ -127,10 +127,13 @@ int main()
std::forward_list<int>::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert (!(ii1 != ii2 ));
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
assert ( (ii1 == cii ));
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
// std::forward_list<int> c;
// assert ( ii1 != c.cbegin());

View File

@ -143,10 +143,13 @@ int main()
std::list<int>::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
assert ( ii1 != c.cbegin());
assert ( cii != c.begin());

View File

@ -49,5 +49,10 @@ int main()
assert(l.size() == 0);
assert(std::distance(l.begin(), l.end()) == 0);
}
{
std::list<int> l = {};
assert(l.size() == 0);
assert(std::distance(l.begin(), l.end()) == 0);
}
#endif
}

View File

@ -26,6 +26,12 @@ test0()
assert(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == typename C::allocator_type());
#if __cplusplus >= 201103L
C c1 = {};
assert(c1.__invariants());
assert(c1.empty());
assert(c1.get_allocator() == typename C::allocator_type());
#endif
}
template <class C>

View File

@ -25,6 +25,7 @@ int main()
std::vector<bool> b(i,true);
std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), false);
assert(j-b.begin() == i);
assert(b.end() == j);
}
}
{
@ -33,6 +34,7 @@ int main()
std::vector<bool> b(i,false);
std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), true);
assert(j-b.begin() == i);
assert(b.end() == j);
}
}
}

View File

@ -101,9 +101,23 @@ int main()
std::vector<bool>::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
assert (!(ii1 < cii ));
assert (!(cii < ii1 ));
assert ( (ii1 <= cii ));
assert ( (cii <= ii1 ));
assert (!(ii1 > cii ));
assert (!(cii > ii1 ));
assert ( (ii1 >= cii ));
assert ( (cii >= ii1 ));
assert (cii - ii1 == 0);
assert (ii1 - cii == 0);
}
#endif
}

View File

@ -0,0 +1,52 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <vector>
// reference operator[](size_type n);
#include <vector>
#include <cassert>
#include <cstdlib>
#include "min_allocator.h"
#include "asan_testing.h"
#ifndef _LIBCPP_HAS_NO_ASAN
extern "C" void __asan_set_error_exit_code(int);
int main()
{
#if __cplusplus >= 201103L
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(std::begin(t), std::end(t));
c.reserve(2*c.size());
T foo = c[c.size()]; // bad, but not caught by ASAN
}
#endif
__asan_set_error_exit_code(0);
{
typedef int T;
typedef std::vector<T> C;
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(std::begin(t), std::end(t));
c.reserve(2*c.size());
assert(is_contiguous_container_asan_correct(c));
assert(!__sanitizer_verify_contiguous_container ( c.data(), c.data() + 1, c.data() + c.capacity()));
T foo = c[c.size()]; // should trigger ASAN
assert(false); // if we got here, ASAN didn't trigger
}
}
#else
int main () { return 0; }
#endif

View File

@ -143,9 +143,23 @@ int main()
C::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
assert (!(ii1 != ii2 ));
assert ( (ii1 == cii ));
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
assert (!(ii1 < cii ));
assert (!(cii < ii1 ));
assert ( (ii1 <= cii ));
assert ( (cii <= ii1 ));
assert (!(ii1 > cii ));
assert (!(cii > ii1 ));
assert ( (ii1 >= cii ));
assert ( (cii >= ii1 ));
assert (cii - ii1 == 0);
assert (ii1 - cii == 0);
}
#endif
}

View File

@ -15,29 +15,34 @@
#include <cassert>
#include "min_allocator.h"
#include "asan_testing.h"
int main()
{
{
std::vector<int> v;
assert(v.capacity() == 0);
assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int> v(100);
assert(v.capacity() == 100);
v.push_back(0);
assert(v.capacity() > 101);
assert(is_contiguous_container_asan_correct(v));
}
#if __cplusplus >= 201103L
{
std::vector<int, min_allocator<int>> v;
assert(v.capacity() == 0);
assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, min_allocator<int>> v(100);
assert(v.capacity() == 100);
v.push_back(0);
assert(v.capacity() > 101);
assert(is_contiguous_container_asan_correct(v));
}
#endif
}

View File

@ -15,6 +15,7 @@
#include <cassert>
#include "../../../stack_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main()
{
@ -22,6 +23,7 @@ int main()
std::vector<int> v;
v.reserve(10);
assert(v.capacity() >= 10);
assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int> v(100);
@ -32,6 +34,7 @@ int main()
v.reserve(150);
assert(v.size() == 100);
assert(v.capacity() == 150);
assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, stack_allocator<int, 250> > v(100);
@ -42,12 +45,14 @@ int main()
v.reserve(150);
assert(v.size() == 100);
assert(v.capacity() == 150);
assert(is_contiguous_container_asan_correct(v));
}
#if __cplusplus >= 201103L
{
std::vector<int, min_allocator<int>> v;
v.reserve(10);
assert(v.capacity() >= 10);
assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, min_allocator<int>> v(100);
@ -58,6 +63,7 @@ int main()
v.reserve(150);
assert(v.size() == 100);
assert(v.capacity() == 150);
assert(is_contiguous_container_asan_correct(v));
}
#endif
}

View File

@ -16,6 +16,7 @@
#include "../../../stack_allocator.h"
#include "../../../MoveOnly.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main()
{
@ -25,18 +26,22 @@ int main()
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
assert(is_contiguous_container_asan_correct(v));
v.resize(200);
assert(v.size() == 200);
assert(v.capacity() >= 200);
assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<MoveOnly, stack_allocator<MoveOnly, 300> > v(100);
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
assert(is_contiguous_container_asan_correct(v));
v.resize(200);
assert(v.size() == 200);
assert(v.capacity() >= 200);
assert(is_contiguous_container_asan_correct(v));
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
@ -44,18 +49,22 @@ int main()
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
assert(is_contiguous_container_asan_correct(v));
v.resize(200);
assert(v.size() == 200);
assert(v.capacity() >= 200);
assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, stack_allocator<int, 300> > v(100);
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
assert(is_contiguous_container_asan_correct(v));
v.resize(200);
assert(v.size() == 200);
assert(v.capacity() >= 200);
assert(is_contiguous_container_asan_correct(v));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if __cplusplus >= 201103L
@ -64,9 +73,11 @@ int main()
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
assert(is_contiguous_container_asan_correct(v));
v.resize(200);
assert(v.size() == 200);
assert(v.capacity() >= 200);
assert(is_contiguous_container_asan_correct(v));
}
#endif
}

View File

@ -15,6 +15,7 @@
#include <cassert>
#include "../../../stack_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main()
{
@ -27,6 +28,7 @@ int main()
v.resize(200, 1);
assert(v.size() == 200);
assert(v.capacity() >= 200);
assert(is_contiguous_container_asan_correct(v));
for (unsigned i = 0; i < 50; ++i)
assert(v[i] == 0);
for (unsigned i = 50; i < 200; ++i)
@ -40,6 +42,7 @@ int main()
v.resize(200, 1);
assert(v.size() == 200);
assert(v.capacity() >= 200);
assert(is_contiguous_container_asan_correct(v));
}
#if __cplusplus >= 201103L
{
@ -47,10 +50,12 @@ int main()
v.resize(50, 1);
assert(v.size() == 50);
assert(v.capacity() == 100);
assert(is_contiguous_container_asan_correct(v));
assert((v == std::vector<int, min_allocator<int>>(50)));
v.resize(200, 1);
assert(v.size() == 200);
assert(v.capacity() >= 200);
assert(is_contiguous_container_asan_correct(v));
for (unsigned i = 0; i < 50; ++i)
assert(v[i] == 0);
for (unsigned i = 50; i < 200; ++i)
@ -61,9 +66,11 @@ int main()
v.resize(50, 1);
assert(v.size() == 50);
assert(v.capacity() == 100);
assert(is_contiguous_container_asan_correct(v));
v.resize(200, 1);
assert(v.size() == 200);
assert(v.capacity() >= 200);
assert(is_contiguous_container_asan_correct(v));
}
#endif
}

View File

@ -15,39 +15,48 @@
#include <cassert>
#include "../../../stack_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main()
{
{
std::vector<int> v(100);
v.push_back(1);
assert(is_contiguous_container_asan_correct(v));
v.shrink_to_fit();
assert(v.capacity() == 101);
assert(v.size() == 101);
assert(is_contiguous_container_asan_correct(v));
}
{
std::vector<int, stack_allocator<int, 401> > v(100);
v.push_back(1);
assert(is_contiguous_container_asan_correct(v));
v.shrink_to_fit();
assert(v.capacity() == 101);
assert(v.size() == 101);
assert(is_contiguous_container_asan_correct(v));
}
#ifndef _LIBCPP_NO_EXCEPTIONS
{
std::vector<int, stack_allocator<int, 400> > v(100);
v.push_back(1);
assert(is_contiguous_container_asan_correct(v));
v.shrink_to_fit();
assert(v.capacity() == 200);
assert(v.size() == 101);
assert(is_contiguous_container_asan_correct(v));
}
#endif
#if __cplusplus >= 201103L
{
std::vector<int, min_allocator<int>> v(100);
v.push_back(1);
assert(is_contiguous_container_asan_correct(v));
v.shrink_to_fit();
assert(v.capacity() == 101);
assert(v.size() == 101);
assert(is_contiguous_container_asan_correct(v));
}
#endif
}

View File

@ -15,27 +15,36 @@
#include <cassert>
#include "min_allocator.h"
#include "asan_testing.h"
int main()
{
{
std::vector<int> v1(100);
std::vector<int> v2(200);
assert(is_contiguous_container_asan_correct(v1));
assert(is_contiguous_container_asan_correct(v2));
v1.swap(v2);
assert(v1.size() == 200);
assert(v1.capacity() == 200);
assert(is_contiguous_container_asan_correct(v1));
assert(v2.size() == 100);
assert(v2.capacity() == 100);
assert(is_contiguous_container_asan_correct(v2));
}
#if __cplusplus >= 201103L
{
std::vector<int, min_allocator<int>> v1(100);
std::vector<int, min_allocator<int>> v2(200);
assert(is_contiguous_container_asan_correct(v1));
assert(is_contiguous_container_asan_correct(v2));
v1.swap(v2);
assert(v1.size() == 200);
assert(v1.capacity() == 200);
assert(is_contiguous_container_asan_correct(v1));
assert(v2.size() == 100);
assert(v2.capacity() == 100);
assert(is_contiguous_container_asan_correct(v2));
}
#endif
}

View File

@ -15,6 +15,7 @@
#include <cassert>
#include "min_allocator.h"
#include "asan_testing.h"
int main()
{
@ -23,6 +24,7 @@ int main()
std::vector<int> d;
d.assign({3, 4, 5, 6});
assert(d.size() == 4);
assert(is_contiguous_container_asan_correct(d));
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);
@ -33,6 +35,7 @@ int main()
std::vector<int, min_allocator<int>> d;
d.assign({3, 4, 5, 6});
assert(d.size() == 4);
assert(is_contiguous_container_asan_correct(d));
assert(d[0] == 3);
assert(d[1] == 4);
assert(d[2] == 5);

View File

@ -16,6 +16,7 @@
#include "../../../MoveOnly.h"
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main()
{
@ -28,54 +29,72 @@ int main()
l.push_back(i);
lo.push_back(i);
}
assert(is_contiguous_container_asan_correct(l));
assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(5));
l2 = std::move(l);
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
assert(is_contiguous_container_asan_correct(l2));
}
{
std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
assert(is_contiguous_container_asan_correct(l));
assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
assert(is_contiguous_container_asan_correct(l));
assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(6));
l2 = std::move(l);
assert(l2 == lo);
assert(!l.empty());
assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
assert(is_contiguous_container_asan_correct(l2));
}
{
std::vector<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
std::vector<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
assert(is_contiguous_container_asan_correct(l));
assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
assert(is_contiguous_container_asan_correct(l));
assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, other_allocator<MoveOnly> > l2(other_allocator<MoveOnly>(6));
l2 = std::move(l);
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
assert(is_contiguous_container_asan_correct(l2));
}
#if __cplusplus >= 201103L
{
std::vector<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
std::vector<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
assert(is_contiguous_container_asan_correct(l));
assert(is_contiguous_container_asan_correct(lo));
for (int i = 1; i <= 3; ++i)
{
l.push_back(i);
lo.push_back(i);
}
assert(is_contiguous_container_asan_correct(l));
assert(is_contiguous_container_asan_correct(lo));
std::vector<MoveOnly, min_allocator<MoveOnly> > l2(min_allocator<MoveOnly>{});
l2 = std::move(l);
assert(l2 == lo);
assert(l.empty());
assert(l2.get_allocator() == lo.get_allocator());
assert(is_contiguous_container_asan_correct(l2));
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

@ -18,6 +18,7 @@
#include "../../../NotConstructible.h"
#include "../../../stack_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
template <class C>
void
@ -27,6 +28,14 @@ test0()
assert(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == typename C::allocator_type());
assert(is_contiguous_container_asan_correct(c));
#if __cplusplus >= 201103L
C c1 = {};
assert(c1.__invariants());
assert(c1.empty());
assert(c1.get_allocator() == typename C::allocator_type());
assert(is_contiguous_container_asan_correct(c1));
#endif
}
template <class C>
@ -37,6 +46,7 @@ test1(const typename C::allocator_type& a)
assert(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == a);
assert(is_contiguous_container_asan_correct(c));
}
int main()

View File

@ -17,6 +17,7 @@
#include "test_iterators.h"
#include "../../../stack_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
template <class C, class Iterator>
void
@ -25,6 +26,7 @@ test(Iterator first, Iterator last)
C c(first, last);
assert(c.__invariants());
assert(c.size() == std::distance(first, last));
assert(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
}

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