Vendor import of libc++ release_40 branch r293443:
https://llvm.org/svn/llvm-project/libcxx/branches/release_40@293443
This commit is contained in:
parent
90c3c6c2a0
commit
3efcd4e54b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/libc++/dist/; revision=312962 svn path=/vendor/libc++/libc++-release_40-r293443/; revision=312963; tag=vendor/libc++/libc++-release_40-r293443
@ -403,15 +403,6 @@ namespace std {
|
||||
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
|
||||
#endif
|
||||
|
||||
// A constexpr version of __builtin_memcmp was added in clang 4.0
|
||||
#if __has_builtin(__builtin_memcmp)
|
||||
# ifdef __apple_build_version__
|
||||
// No shipping version of Apple's clang has constexpr __builtin_memcmp
|
||||
# elif __clang_major__ > 3
|
||||
# define _LIBCPP_BUILTIN_MEMCMP_ISCONSTEXPR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#elif defined(_LIBCPP_COMPILER_GCC)
|
||||
|
||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
|
@ -243,7 +243,7 @@ char_traits<char>::compare(const char_type* __s1, const char_type* __s2, size_t
|
||||
{
|
||||
if (__n == 0)
|
||||
return 0;
|
||||
#ifdef _LIBCPP_BUILTIN_MEMCMP_ISCONSTEXPR
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_memcmp(__s1, __s2, __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return memcmp(__s1, __s2, __n);
|
||||
@ -265,7 +265,9 @@ char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
{
|
||||
if (__n == 0)
|
||||
return NULL;
|
||||
#if _LIBCPP_STD_VER <= 14
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_char_memchr(__s, to_int_type(__a), __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return (const char_type*) memchr(__s, to_int_type(__a), __n);
|
||||
#else
|
||||
for (; __n; --__n)
|
||||
@ -331,7 +333,7 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size
|
||||
{
|
||||
if (__n == 0)
|
||||
return 0;
|
||||
#if __has_builtin(__builtin_wmemcmp)
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_wmemcmp(__s1, __s2, __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return wmemcmp(__s1, __s2, __n);
|
||||
@ -351,7 +353,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
size_t
|
||||
char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT
|
||||
{
|
||||
#if __has_builtin(__builtin_wcslen)
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_wcslen(__s);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return wcslen(__s);
|
||||
@ -369,7 +371,7 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __
|
||||
{
|
||||
if (__n == 0)
|
||||
return NULL;
|
||||
#if __has_builtin(__builtin_wmemchr)
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_wmemchr(__s, __a, __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return wmemchr(__s, __a, __n);
|
||||
|
@ -40,6 +40,12 @@
|
||||
#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) && defined(__clang__) && __has_attribute(no_thread_safety_analysis)
|
||||
#define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis))
|
||||
#else
|
||||
#define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
@ -98,25 +104,25 @@ typedef DWORD __libcpp_tls_key;
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_mutex_lock(__libcpp_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
@ -129,10 +135,10 @@ int __libcpp_condvar_signal(__libcpp_condvar_t* __cv);
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
|
||||
timespec *__ts);
|
||||
|
||||
|
@ -110,8 +110,8 @@ public:
|
||||
void push_front(value_type&& v);
|
||||
void push_back(const value_type& v);
|
||||
void push_back(value_type&& v);
|
||||
template <class... Args> reference emplace_front(Args&&... args);
|
||||
template <class... Args> reference emplace_back(Args&&... args);
|
||||
template <class... Args> reference emplace_front(Args&&... args); // reference in C++17
|
||||
template <class... Args> reference emplace_back(Args&&... args); // reference in C++17
|
||||
template <class... Args> iterator emplace(const_iterator p, Args&&... args);
|
||||
iterator insert(const_iterator p, const value_type& v);
|
||||
iterator insert(const_iterator p, value_type&& v);
|
||||
@ -1342,8 +1342,13 @@ public:
|
||||
void push_back(const value_type& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class... _Args> reference emplace_front(_Args&&... __args);
|
||||
template <class... _Args> reference emplace_back(_Args&&... __args);
|
||||
template <class... _Args> reference emplace_back (_Args&&... __args);
|
||||
#else
|
||||
template <class... _Args> void emplace_front(_Args&&... __args);
|
||||
template <class... _Args> void emplace_back (_Args&&... __args);
|
||||
#endif
|
||||
template <class... _Args> iterator emplace(const_iterator __p, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
void push_front(value_type&& __v);
|
||||
@ -1822,7 +1827,11 @@ deque<_Tp, _Allocator>::push_back(value_type&& __v)
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
typename deque<_Tp, _Allocator>::reference
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
{
|
||||
allocator_type& __a = __base::__alloc();
|
||||
@ -1832,7 +1841,9 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
++__base::size();
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
return *--__base::end();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
@ -1870,7 +1881,11 @@ deque<_Tp, _Allocator>::push_front(value_type&& __v)
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
typename deque<_Tp, _Allocator>::reference
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
|
||||
{
|
||||
allocator_type& __a = __base::__alloc();
|
||||
@ -1880,7 +1895,9 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
return *__base::begin();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
reference front();
|
||||
const_reference front() const;
|
||||
|
||||
template <class... Args> reference emplace_front(Args&&... args);
|
||||
template <class... Args> reference emplace_front(Args&&... args); // reference in C++17
|
||||
void push_front(const value_type& v);
|
||||
void push_front(value_type&& v);
|
||||
|
||||
@ -747,7 +747,11 @@ public:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class... _Args> reference emplace_front(_Args&&... __args);
|
||||
#else
|
||||
template <class... _Args> void emplace_front(_Args&&... __args);
|
||||
#endif
|
||||
#endif
|
||||
void push_front(value_type&& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@ -1103,7 +1107,11 @@ forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
typename forward_list<_Tp, _Alloc>::reference
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||
{
|
||||
__node_allocator& __a = base::__alloc();
|
||||
@ -1113,7 +1121,9 @@ forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__h->__next_ = base::__before_begin()->__next_;
|
||||
base::__before_begin()->__next_ = __h.release();
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
return base::__before_begin()->__next_->__value_;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
28
include/list
28
include/list
@ -93,10 +93,10 @@ public:
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
template <class... Args>
|
||||
reference emplace_front(Args&&... args);
|
||||
reference emplace_front(Args&&... args); // reference in C++17
|
||||
void pop_front();
|
||||
template <class... Args>
|
||||
reference emplace_back(Args&&... args);
|
||||
reference emplace_back(Args&&... args); // reference in C++17
|
||||
void pop_back();
|
||||
void push_front(const value_type& x);
|
||||
void push_front(value_type&& x);
|
||||
@ -969,9 +969,17 @@ public:
|
||||
void push_back(value_type&& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
reference emplace_front(_Args&&... __args);
|
||||
#else
|
||||
void emplace_front(_Args&&... __args);
|
||||
#endif
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
reference emplace_back(_Args&&... __args);
|
||||
#else
|
||||
void emplace_back(_Args&&... __args);
|
||||
#endif
|
||||
template <class... _Args>
|
||||
iterator emplace(const_iterator __p, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
@ -1600,7 +1608,11 @@ list<_Tp, _Alloc>::push_back(value_type&& __x)
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
typename list<_Tp, _Alloc>::reference
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||
{
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
@ -1609,12 +1621,20 @@ list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link());
|
||||
++base::__sz();
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
return __hold.release()->__value_;
|
||||
#else
|
||||
__hold.release();
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
typename list<_Tp, _Alloc>::reference
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
|
||||
{
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
@ -1624,7 +1644,11 @@ list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
|
||||
__link_pointer __nl = __hold->__as_link();
|
||||
__link_nodes_at_back(__nl, __nl);
|
||||
++base::__sz();
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
return __hold.release()->__value_;
|
||||
#else
|
||||
__hold.release();
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
|
||||
void push(const value_type& v);
|
||||
void push(value_type&& v);
|
||||
template <class... Args> reference emplace(Args&&... args);
|
||||
template <class... Args> reference emplace(Args&&... args); // reference in C++17
|
||||
void pop();
|
||||
|
||||
void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>)
|
||||
@ -292,8 +292,13 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
reference emplace(_Args&&... __args)
|
||||
{ return c.emplace_back(_VSTD::forward<_Args>(__args)...);}
|
||||
#else
|
||||
void emplace(_Args&&... __args)
|
||||
{ c.emplace_back(_VSTD::forward<_Args>(__args)...);}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
void push(const value_type& x);
|
||||
void push(value_type&& x);
|
||||
template <class... Args> reference emplace(Args&&... args);
|
||||
template <class... Args> reference emplace(Args&&... args); // reference in C++17
|
||||
void pop();
|
||||
|
||||
void swap(stack& c) noexcept(is_nothrow_swappable_v<Container>)
|
||||
@ -199,8 +199,13 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
reference emplace(_Args&&... __args)
|
||||
{ return c.emplace_back(_VSTD::forward<_Args>(__args)...);}
|
||||
#else
|
||||
void emplace(_Args&&... __args)
|
||||
{ c.emplace_back(_VSTD::forward<_Args>(__args)...);}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
void push_back(const value_type& x);
|
||||
void push_back(value_type&& x);
|
||||
template <class... Args>
|
||||
reference emplace_back(Args&&... args);
|
||||
reference emplace_back(Args&&... args); // reference in C++17
|
||||
void pop_back();
|
||||
|
||||
template <class... Args> iterator emplace(const_iterator position, Args&&... args);
|
||||
@ -218,7 +218,7 @@ public:
|
||||
const_reference back() const;
|
||||
|
||||
void push_back(const value_type& x);
|
||||
template <class... Args> reference emplace_back(Args&&... args); // C++14
|
||||
template <class... Args> reference emplace_back(Args&&... args); // C++14; reference in C++17
|
||||
void pop_back();
|
||||
|
||||
template <class... Args> iterator emplace(const_iterator position, Args&&... args); // C++14
|
||||
@ -679,7 +679,11 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
reference emplace_back(_Args&&... __args);
|
||||
#else
|
||||
void emplace_back(_Args&&... __args);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1625,7 +1629,11 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
inline
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
typename vector<_Tp, _Allocator>::reference
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
{
|
||||
if (this->__end_ < this->__end_cap())
|
||||
@ -1639,7 +1647,9 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
}
|
||||
else
|
||||
__emplace_back_slow_path(_VSTD::forward<_Args>(__args)...);
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
return this->back();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
@ -2336,9 +2346,16 @@ public:
|
||||
void push_back(const value_type& __x);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY reference emplace_back(_Args&&... __args) {
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
_LIBCPP_INLINE_VISIBILITY reference emplace_back(_Args&&... __args)
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY void emplace_back(_Args&&... __args)
|
||||
#endif
|
||||
{
|
||||
push_back ( value_type ( _VSTD::forward<_Args>(__args)... ));
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
return this->back();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -403,6 +403,15 @@ def configure_default_compile_flags(self):
|
||||
if not std:
|
||||
# Choose the newest possible language dialect if none is given.
|
||||
possible_stds = ['c++1z', 'c++14', 'c++11', 'c++03']
|
||||
if self.cxx.type == 'gcc':
|
||||
maj_v, _, _ = self.cxx.version
|
||||
maj_v = int(maj_v)
|
||||
if maj_v < 7:
|
||||
possible_stds.remove('c++1z')
|
||||
# FIXME: How many C++14 tests actually fail under GCC 5 and 6?
|
||||
# Should we XFAIL them individually instead?
|
||||
if maj_v <= 6:
|
||||
possible_stds.remove('c++14')
|
||||
for s in possible_stds:
|
||||
if self.cxx.hasCompileFlag('-std=%s' % s):
|
||||
std = s
|
||||
|
@ -12,25 +12,35 @@
|
||||
// <queue>
|
||||
|
||||
// template <class... Args> reference emplace(Args&&... args);
|
||||
// return type is 'reference' in C++17; 'void' before
|
||||
|
||||
|
||||
#include <queue>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#include "../../../Emplaceable.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef Emplaceable T;
|
||||
std::queue<Emplaceable> q;
|
||||
#if TEST_STD_VER > 14
|
||||
T& r1 = q.emplace(1, 2.5);
|
||||
assert(&r1 == &q.back());
|
||||
T& r2 = q.emplace(2, 3.5);
|
||||
assert(&r2 == &q.back());
|
||||
T& r3 = q.emplace(3, 4.5);
|
||||
assert(&r3 == &q.back());
|
||||
assert(&r1 == &q.front());
|
||||
#else
|
||||
q.emplace(1, 2.5);
|
||||
q.emplace(2, 3.5);
|
||||
q.emplace(3, 4.5);
|
||||
#endif
|
||||
|
||||
assert(q.size() == 3);
|
||||
assert(q.front() == Emplaceable(1, 2.5));
|
||||
assert(q.back() == Emplaceable(3, 4.5));
|
||||
assert(&r3 == &q.back());
|
||||
assert(&r1 == &q.front());
|
||||
}
|
||||
|
@ -12,22 +12,31 @@
|
||||
// <stack>
|
||||
|
||||
// template <class... Args> reference emplace(Args&&... args);
|
||||
// return type is 'reference' in C++17; 'void' before
|
||||
|
||||
#include <stack>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#include "../../../Emplaceable.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef Emplaceable T;
|
||||
std::stack<Emplaceable> q;
|
||||
#if TEST_STD_VER > 14
|
||||
T& r1 = q.emplace(1, 2.5);
|
||||
assert(&r1 == &q.top());
|
||||
T& r2 = q.emplace(2, 3.5);
|
||||
assert(&r2 == &q.top());
|
||||
T& r3 = q.emplace(3, 4.5);
|
||||
assert(&r3 == &q.top());
|
||||
#else
|
||||
q.emplace(1, 2.5);
|
||||
q.emplace(2, 3.5);
|
||||
q.emplace(3, 4.5);
|
||||
#endif
|
||||
assert(q.size() == 3);
|
||||
assert(q.top() == Emplaceable(3, 4.5));
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
// <deque>
|
||||
|
||||
// template <class... Args> reference emplace_back(Args&&... args);
|
||||
// return type is 'reference' in C++17; 'void' before
|
||||
|
||||
#include <deque>
|
||||
#include <cstddef>
|
||||
@ -49,15 +50,21 @@ void
|
||||
test(C& c1)
|
||||
{
|
||||
typedef typename C::iterator I;
|
||||
typedef typename C::reference Ref;
|
||||
std::size_t c1_osize = c1.size();
|
||||
#if TEST_STD_VER > 14
|
||||
typedef typename C::reference Ref;
|
||||
Ref ref = c1.emplace_back(Emplaceable(1, 2.5));
|
||||
#else
|
||||
c1.emplace_back(Emplaceable(1, 2.5));
|
||||
#endif
|
||||
assert(c1.size() == c1_osize + 1);
|
||||
assert(distance(c1.begin(), c1.end())
|
||||
== static_cast<std::ptrdiff_t>(c1.size()));
|
||||
I i = c1.end();
|
||||
assert(*--i == Emplaceable(1, 2.5));
|
||||
#if TEST_STD_VER > 14
|
||||
assert(&(*i) == &ref);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class C>
|
||||
|
@ -12,6 +12,7 @@
|
||||
// <deque>
|
||||
|
||||
// template <class... Args> reference emplace_front(Args&&... args);
|
||||
// return type is 'reference' in C++17; 'void' before
|
||||
|
||||
#include <deque>
|
||||
#include <cstddef>
|
||||
@ -20,6 +21,7 @@
|
||||
#include "test_macros.h"
|
||||
#include "../../../Emplaceable.h"
|
||||
#include "min_allocator.h"
|
||||
#include "test_allocator.h"
|
||||
|
||||
template <class C>
|
||||
C
|
||||
@ -48,15 +50,21 @@ void
|
||||
test(C& c1)
|
||||
{
|
||||
typedef typename C::iterator I;
|
||||
typedef typename C::reference Ref;
|
||||
std::size_t c1_osize = c1.size();
|
||||
#if TEST_STD_VER > 14
|
||||
typedef typename C::reference Ref;
|
||||
Ref res_ref = c1.emplace_front(Emplaceable(1, 2.5));
|
||||
#else
|
||||
c1.emplace_front(Emplaceable(1, 2.5));
|
||||
#endif
|
||||
assert(c1.size() == c1_osize + 1);
|
||||
assert(distance(c1.begin(), c1.end())
|
||||
== static_cast<std::ptrdiff_t>(c1.size()));
|
||||
I i = c1.begin();
|
||||
assert(*i == Emplaceable(1, 2.5));
|
||||
#if TEST_STD_VER > 14
|
||||
assert(&res_ref == &(*i));
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class C>
|
||||
@ -84,4 +92,15 @@ int main()
|
||||
for (int j = 0; j < N; ++j)
|
||||
testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
|
||||
}
|
||||
{
|
||||
std::deque<Tag_X, TaggingAllocator<Tag_X>> c;
|
||||
c.emplace_front();
|
||||
assert(c.size() == 1);
|
||||
c.emplace_front(1, 2, 3);
|
||||
assert(c.size() == 2);
|
||||
c.emplace_front();
|
||||
assert(c.size() == 3);
|
||||
c.emplace_front(1, 2, 3);
|
||||
assert(c.size() == 4);
|
||||
}
|
||||
}
|
||||
|
@ -12,10 +12,13 @@
|
||||
// <forward_list>
|
||||
|
||||
// template <class... Args> reference emplace_front(Args&&... args);
|
||||
// return type is 'reference' in C++17; 'void' before
|
||||
|
||||
#include <forward_list>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#include "../../../Emplaceable.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
@ -25,6 +28,7 @@ int main()
|
||||
typedef Emplaceable T;
|
||||
typedef std::forward_list<T> C;
|
||||
C c;
|
||||
#if TEST_STD_VER > 14
|
||||
T& r1 = c.emplace_front();
|
||||
assert(c.front() == Emplaceable());
|
||||
assert(&r1 == &c.front());
|
||||
@ -32,6 +36,13 @@ int main()
|
||||
T& r2 = c.emplace_front(1, 2.5);
|
||||
assert(c.front() == Emplaceable(1, 2.5));
|
||||
assert(&r2 == &c.front());
|
||||
#else
|
||||
c.emplace_front();
|
||||
assert(c.front() == Emplaceable());
|
||||
assert(distance(c.begin(), c.end()) == 1);
|
||||
c.emplace_front(1, 2.5);
|
||||
assert(c.front() == Emplaceable(1, 2.5));
|
||||
#endif
|
||||
assert(*next(c.begin()) == Emplaceable());
|
||||
assert(distance(c.begin(), c.end()) == 2);
|
||||
}
|
||||
@ -39,6 +50,7 @@ int main()
|
||||
typedef Emplaceable T;
|
||||
typedef std::forward_list<T, min_allocator<T>> C;
|
||||
C c;
|
||||
#if TEST_STD_VER > 14
|
||||
T& r1 = c.emplace_front();
|
||||
assert(c.front() == Emplaceable());
|
||||
assert(&r1 == &c.front());
|
||||
@ -46,6 +58,13 @@ int main()
|
||||
T& r2 = c.emplace_front(1, 2.5);
|
||||
assert(c.front() == Emplaceable(1, 2.5));
|
||||
assert(&r2 == &c.front());
|
||||
#else
|
||||
c.emplace_front();
|
||||
assert(c.front() == Emplaceable());
|
||||
assert(distance(c.begin(), c.end()) == 1);
|
||||
c.emplace_front(1, 2.5);
|
||||
assert(c.front() == Emplaceable(1, 2.5));
|
||||
#endif
|
||||
assert(*next(c.begin()) == Emplaceable());
|
||||
assert(distance(c.begin(), c.end()) == 2);
|
||||
}
|
||||
|
@ -12,10 +12,12 @@
|
||||
// <list>
|
||||
|
||||
// template <class... Args> reference emplace_back(Args&&... args);
|
||||
// return type is 'reference' in C++17; 'void' before
|
||||
|
||||
#include <list>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
class A
|
||||
@ -37,6 +39,7 @@ int main()
|
||||
{
|
||||
{
|
||||
std::list<A> c;
|
||||
#if TEST_STD_VER > 14
|
||||
A& r1 = c.emplace_back(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(&r1 == &c.back());
|
||||
@ -45,6 +48,14 @@ int main()
|
||||
A& r2 = c.emplace_back(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
assert(&r2 == &c.back());
|
||||
#else
|
||||
c.emplace_back(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
c.emplace_back(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
#endif
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
assert(c.back().geti() == 3);
|
||||
@ -52,6 +63,7 @@ int main()
|
||||
}
|
||||
{
|
||||
std::list<A, min_allocator<A>> c;
|
||||
#if TEST_STD_VER > 14
|
||||
A& r1 = c.emplace_back(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(&r1 == &c.back());
|
||||
@ -60,6 +72,14 @@ int main()
|
||||
A& r2 = c.emplace_back(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
assert(&r2 == &c.back());
|
||||
#else
|
||||
c.emplace_back(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
c.emplace_back(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
#endif
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
assert(c.back().geti() == 3);
|
||||
|
@ -12,6 +12,7 @@
|
||||
// <list>
|
||||
|
||||
// template <class... Args> reference emplace_front(Args&&... args);
|
||||
// return type is 'reference' in C++17; 'void' before
|
||||
|
||||
#include <list>
|
||||
#include <cassert>
|
||||
@ -37,6 +38,7 @@ int main()
|
||||
{
|
||||
{
|
||||
std::list<A> c;
|
||||
#if TEST_STD_VER > 14
|
||||
A& r1 = c.emplace_front(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(&r1 == &c.front());
|
||||
@ -45,13 +47,23 @@ int main()
|
||||
A& r2 = c.emplace_front(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
assert(&r2 == &c.front());
|
||||
#else
|
||||
c.emplace_front(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
c.emplace_front(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
#endif
|
||||
assert(c.front().geti() == 3);
|
||||
assert(c.front().getd() == 4.5);
|
||||
assert(c.back().geti() == 2);
|
||||
assert(c.back().getd() == 3.5);
|
||||
}
|
||||
|
||||
{
|
||||
std::list<A, min_allocator<A>> c;
|
||||
#if TEST_STD_VER > 14
|
||||
A& r1 = c.emplace_front(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(&r1 == &c.front());
|
||||
@ -60,6 +72,14 @@ int main()
|
||||
A& r2 = c.emplace_front(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
assert(&r2 == &c.front());
|
||||
#else
|
||||
c.emplace_front(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
c.emplace_front(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
#endif
|
||||
assert(c.front().geti() == 3);
|
||||
assert(c.front().getd() == 4.5);
|
||||
assert(c.back().geti() == 2);
|
||||
|
@ -12,17 +12,20 @@
|
||||
// vector.bool
|
||||
|
||||
// template <class... Args> reference emplace_back(Args&&... args);
|
||||
// return type is 'reference' in C++17; 'void' before
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::vector<bool> C;
|
||||
typedef C::reference Ref;
|
||||
C c;
|
||||
#if TEST_STD_VER > 14
|
||||
typedef C::reference Ref;
|
||||
Ref r1 = c.emplace_back();
|
||||
assert(c.size() == 1);
|
||||
assert(c.front() == false);
|
||||
@ -36,19 +39,27 @@ int main()
|
||||
r2 = false;
|
||||
assert(c.back() == false);
|
||||
r2 = true;
|
||||
Ref r3 = c.emplace_back(1 == 1);
|
||||
#else
|
||||
c.emplace_back();
|
||||
assert(c.size() == 1);
|
||||
assert(c.front() == false);
|
||||
c.emplace_back(true);
|
||||
assert(c.size() == 2);
|
||||
assert(c.front() == false);
|
||||
assert(c.back() == true);
|
||||
#endif
|
||||
c.emplace_back(1 == 1);
|
||||
assert(c.size() == 3);
|
||||
assert(c.front() == false);
|
||||
assert(c[1] == true);
|
||||
assert(c.back() == true);
|
||||
r3 = false;
|
||||
assert(c.back() == false);
|
||||
}
|
||||
{
|
||||
typedef std::vector<bool, min_allocator<bool>> C;
|
||||
typedef C::reference Ref;
|
||||
C c;
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
typedef C::reference Ref;
|
||||
Ref r1 = c.emplace_back();
|
||||
assert(c.size() == 1);
|
||||
assert(c.front() == false);
|
||||
@ -62,6 +73,15 @@ int main()
|
||||
r2 = false;
|
||||
assert(c.back() == false);
|
||||
r2 = true;
|
||||
#else
|
||||
c.emplace_back();
|
||||
assert(c.size() == 1);
|
||||
assert(c.front() == false);
|
||||
c.emplace_back(true);
|
||||
assert(c.size() == 2);
|
||||
assert(c.front() == false);
|
||||
assert(c.back() == true);
|
||||
#endif
|
||||
c.emplace_back(1 == 1);
|
||||
assert(c.size() == 3);
|
||||
assert(c.front() == false);
|
||||
|
@ -12,9 +12,11 @@
|
||||
// <vector>
|
||||
|
||||
// template <class... Args> reference emplace_back(Args&&... args);
|
||||
// return type is 'reference' in C++17; 'void' before
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include "test_macros.h"
|
||||
#include "test_allocator.h"
|
||||
#include "min_allocator.h"
|
||||
#include "test_allocator.h"
|
||||
@ -56,6 +58,7 @@ int main()
|
||||
{
|
||||
{
|
||||
std::vector<A> c;
|
||||
#if TEST_STD_VER > 14
|
||||
A& r1 = c.emplace_back(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(&r1 == &c.back());
|
||||
@ -65,6 +68,15 @@ int main()
|
||||
A& r2 = c.emplace_back(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
assert(&r2 == &c.back());
|
||||
#else
|
||||
c.emplace_back(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
assert(is_contiguous_container_asan_correct(c));
|
||||
c.emplace_back(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
#endif
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
assert(c.back().geti() == 3);
|
||||
@ -73,6 +85,7 @@ int main()
|
||||
}
|
||||
{
|
||||
std::vector<A, limited_allocator<A, 4> > c;
|
||||
#if TEST_STD_VER > 14
|
||||
A& r1 = c.emplace_back(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(&r1 == &c.back());
|
||||
@ -82,6 +95,15 @@ int main()
|
||||
A& r2 = c.emplace_back(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
assert(&r2 == &c.back());
|
||||
#else
|
||||
c.emplace_back(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
assert(is_contiguous_container_asan_correct(c));
|
||||
c.emplace_back(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
#endif
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
assert(c.back().geti() == 3);
|
||||
@ -90,6 +112,7 @@ int main()
|
||||
}
|
||||
{
|
||||
std::vector<A, min_allocator<A>> c;
|
||||
#if TEST_STD_VER > 14
|
||||
A& r1 = c.emplace_back(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(&r1 == &c.back());
|
||||
@ -99,6 +122,15 @@ int main()
|
||||
A& r2 = c.emplace_back(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
assert(&r2 == &c.back());
|
||||
#else
|
||||
c.emplace_back(2, 3.5);
|
||||
assert(c.size() == 1);
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
assert(is_contiguous_container_asan_correct(c));
|
||||
c.emplace_back(3, 4.5);
|
||||
assert(c.size() == 2);
|
||||
#endif
|
||||
assert(c.front().geti() == 2);
|
||||
assert(c.front().getd() == 3.5);
|
||||
assert(c.back().geti() == 3);
|
||||
|
@ -376,10 +376,10 @@
|
||||
<tr><td><a href="http://wg21.link/LWG2680">2680</a></td><td>Add "Equivalent to" to filesystem</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2681">2681</a></td><td>filesystem::copy() cannot copy symlinks</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2682">2682</a></td><td>filesystem::copy() won't create a symlink to a directory</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2686">2686</a></td><td>Why is std::hash specialized for error_code, but not error_condition?</td><td>Issaquah</td><td>Patch ready</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2686">2686</a></td><td>Why is std::hash specialized for error_code, but not error_condition?</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2694">2694</a></td><td>Application of LWG 436 accidentally deleted definition of "facet"</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2696">2696</a></td><td>Interaction between make_shared and enable_shared_from_this is underspecified</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2699">2699</a></td><td>Missing restriction in [numeric.requirements]</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2699">2699</a></td><td>Missing restriction in [numeric.requirements]</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2712">2712</a></td><td>copy_file(from, to, ...) has a number of unspecified error conditions</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2722">2722</a></td><td>equivalent incorrectly specifies throws clause</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2729">2729</a></td><td>Missing SFINAE on std::pair::operator=</td><td>Issaquah</td><td></td></tr>
|
||||
|
Loading…
Reference in New Issue
Block a user