Implement LWG 2946, 3075 and 3076. Reviewed as https://reviews.llvm.org/D48616
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336132 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -5638,15 +5638,15 @@ struct __temp_value {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 14
|
template<typename _Alloc, typename = void, typename = void>
|
||||||
template<typename _Alloc, typename = void>
|
|
||||||
struct __is_allocator : false_type {};
|
struct __is_allocator : false_type {};
|
||||||
|
|
||||||
template<typename _Alloc>
|
template<typename _Alloc>
|
||||||
struct __is_allocator<_Alloc,
|
struct __is_allocator<_Alloc,
|
||||||
void_t<typename _Alloc::value_type, decltype(_VSTD::declval<_Alloc&>().allocate(size_t{}))>>
|
typename __void_t<typename _Alloc::value_type>::type,
|
||||||
|
typename __void_t<decltype(_VSTD::declval<_Alloc&>().allocate(size_t(0)))>::type
|
||||||
|
>
|
||||||
: true_type {};
|
: true_type {};
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
395
include/string
395
include/string
@@ -104,7 +104,8 @@ public:
|
|||||||
const Allocator& a = Allocator());
|
const Allocator& a = Allocator());
|
||||||
template<class T>
|
template<class T>
|
||||||
basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); // C++17
|
basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); // C++17
|
||||||
explicit basic_string(const basic_string_view<charT, traits> sv, const Allocator& a = Allocator());
|
template <class T>
|
||||||
|
explicit basic_string(const T& t, const Allocator& a = Allocator()); // C++17
|
||||||
basic_string(const value_type* s, const allocator_type& a = allocator_type());
|
basic_string(const value_type* s, const allocator_type& a = allocator_type());
|
||||||
basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type());
|
basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type());
|
||||||
basic_string(size_type n, value_type c, const allocator_type& a = allocator_type());
|
basic_string(size_type n, value_type c, const allocator_type& a = allocator_type());
|
||||||
@@ -120,7 +121,8 @@ public:
|
|||||||
operator basic_string_view<charT, traits>() const noexcept;
|
operator basic_string_view<charT, traits>() const noexcept;
|
||||||
|
|
||||||
basic_string& operator=(const basic_string& str);
|
basic_string& operator=(const basic_string& str);
|
||||||
basic_string& operator=(basic_string_view<charT, traits> sv);
|
template <class T>
|
||||||
|
basic_string& operator=(const T& t); // C++17
|
||||||
basic_string& operator=(basic_string&& str)
|
basic_string& operator=(basic_string&& str)
|
||||||
noexcept(
|
noexcept(
|
||||||
allocator_type::propagate_on_container_move_assignment::value ||
|
allocator_type::propagate_on_container_move_assignment::value ||
|
||||||
@@ -164,13 +166,15 @@ public:
|
|||||||
reference at(size_type n);
|
reference at(size_type n);
|
||||||
|
|
||||||
basic_string& operator+=(const basic_string& str);
|
basic_string& operator+=(const basic_string& str);
|
||||||
basic_string& operator+=(basic_string_view<charT, traits> sv);
|
template <class T>
|
||||||
|
basic_string& operator+=(const T& t); // C++17
|
||||||
basic_string& operator+=(const value_type* s);
|
basic_string& operator+=(const value_type* s);
|
||||||
basic_string& operator+=(value_type c);
|
basic_string& operator+=(value_type c);
|
||||||
basic_string& operator+=(initializer_list<value_type>);
|
basic_string& operator+=(initializer_list<value_type>);
|
||||||
|
|
||||||
basic_string& append(const basic_string& str);
|
basic_string& append(const basic_string& str);
|
||||||
basic_string& append(basic_string_view<charT, traits> sv);
|
template <class T>
|
||||||
|
basic_string& append(const T& t); // C++17
|
||||||
basic_string& append(const basic_string& str, size_type pos, size_type n=npos); //C++14
|
basic_string& append(const basic_string& str, size_type pos, size_type n=npos); //C++14
|
||||||
template <class T>
|
template <class T>
|
||||||
basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17
|
basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17
|
||||||
@@ -189,7 +193,8 @@ public:
|
|||||||
const_reference back() const;
|
const_reference back() const;
|
||||||
|
|
||||||
basic_string& assign(const basic_string& str);
|
basic_string& assign(const basic_string& str);
|
||||||
basic_string& assign(basic_string_view<charT, traits> sv);
|
template <class T>
|
||||||
|
basic_string& assign(const T& t); // C++17
|
||||||
basic_string& assign(basic_string&& str);
|
basic_string& assign(basic_string&& str);
|
||||||
basic_string& assign(const basic_string& str, size_type pos, size_type n=npos); // C++14
|
basic_string& assign(const basic_string& str, size_type pos, size_type n=npos); // C++14
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -202,7 +207,8 @@ public:
|
|||||||
basic_string& assign(initializer_list<value_type>);
|
basic_string& assign(initializer_list<value_type>);
|
||||||
|
|
||||||
basic_string& insert(size_type pos1, const basic_string& str);
|
basic_string& insert(size_type pos1, const basic_string& str);
|
||||||
basic_string& insert(size_type pos1, basic_string_view<charT, traits> sv);
|
template <class T>
|
||||||
|
basic_string& insert(size_type pos1, const T& t);
|
||||||
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);
|
size_type pos2, size_type n);
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -221,7 +227,8 @@ public:
|
|||||||
iterator erase(const_iterator first, const_iterator last);
|
iterator erase(const_iterator first, const_iterator last);
|
||||||
|
|
||||||
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);
|
||||||
basic_string& replace(size_type pos1, size_type n1, basic_string_view<charT, traits> sv);
|
template <class T>
|
||||||
|
basic_string& replace(size_type pos1, size_type n1, const T& t); // C++17
|
||||||
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=npos); // C++14
|
size_type pos2, size_type n2=npos); // C++14
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -231,7 +238,8 @@ public:
|
|||||||
basic_string& replace(size_type pos, size_type n1, const value_type* s);
|
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);
|
basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
|
||||||
basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
|
basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
|
||||||
basic_string& replace(const_iterator i1, const_iterator i2, basic_string_view<charT, traits> sv);
|
template <class T>
|
||||||
|
basic_string& replace(const_iterator i1, const_iterator i2, const T& t); // C++17
|
||||||
basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n);
|
basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n);
|
||||||
basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s);
|
basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s);
|
||||||
basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
|
basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
|
||||||
@@ -253,45 +261,53 @@ public:
|
|||||||
allocator_type get_allocator() const noexcept;
|
allocator_type get_allocator() const noexcept;
|
||||||
|
|
||||||
size_type find(const basic_string& str, size_type pos = 0) const noexcept;
|
size_type find(const basic_string& str, size_type pos = 0) const noexcept;
|
||||||
size_type find(basic_string_view<charT, traits> sv, size_type pos = 0) const noexcept;
|
template <class T>
|
||||||
|
size_type find(const T& t, size_type pos = 0) const; // C++17
|
||||||
size_type find(const value_type* s, size_type pos, size_type n) const noexcept;
|
size_type find(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||||
size_type find(const value_type* s, size_type pos = 0) const noexcept;
|
size_type find(const value_type* s, size_type pos = 0) const noexcept;
|
||||||
size_type find(value_type c, size_type pos = 0) const noexcept;
|
size_type find(value_type c, size_type pos = 0) const noexcept;
|
||||||
|
|
||||||
size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
|
size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
|
||||||
size_type rfind(basic_string_view<charT, traits> sv, size_type pos = npos) const noexcept;
|
template <class T>
|
||||||
|
size_type rfind(const T& t, size_type pos = npos) const; // C++17
|
||||||
size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept;
|
size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||||
size_type rfind(const value_type* s, size_type pos = npos) const noexcept;
|
size_type rfind(const value_type* s, size_type pos = npos) const noexcept;
|
||||||
size_type rfind(value_type c, size_type pos = npos) const noexcept;
|
size_type rfind(value_type c, size_type pos = npos) const noexcept;
|
||||||
|
|
||||||
size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
|
size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
|
||||||
size_type find_first_of(basic_string_view<charT, traits> sv, size_type pos = 0) const noexcept;
|
template <class T>
|
||||||
|
size_type find_first_of(const T& t, size_type pos = 0) const; // C++17
|
||||||
size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||||
size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept;
|
size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept;
|
||||||
size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
|
size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
|
||||||
|
|
||||||
size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
|
size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
|
||||||
size_type find_last_of(basic_string_view<charT, traits> sv, size_type pos = npos) const noexcept;
|
template <class T>
|
||||||
|
size_type find_last_of(const T& t, size_type pos = npos) const noexcept; // C++17
|
||||||
size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||||
size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept;
|
size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept;
|
||||||
size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
|
size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
|
||||||
|
|
||||||
size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept;
|
size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept;
|
||||||
size_type find_first_not_of(basic_string_view<charT, traits> sv, size_type pos = 0) const noexcept;
|
template <class T>
|
||||||
|
size_type find_first_not_of(const T& t, size_type pos = 0) const; // C++17
|
||||||
size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||||
size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept;
|
size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept;
|
||||||
size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept;
|
size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept;
|
||||||
|
|
||||||
size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
|
size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
|
||||||
size_type find_last_not_of(basic_string_view<charT, traits> sv, size_type pos = npos) const noexcept;
|
template <class T>
|
||||||
|
size_type find_last_not_of(const T& t, size_type pos = npos) const; // C++17
|
||||||
size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
||||||
size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept;
|
size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept;
|
||||||
size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept;
|
size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept;
|
||||||
|
|
||||||
int compare(const basic_string& str) const noexcept;
|
int compare(const basic_string& str) const noexcept;
|
||||||
int compare(basic_string_view<charT, traits> sv) const noexcept;
|
template <class T>
|
||||||
|
int compare(const T& t) const noexcept; // C++17
|
||||||
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) const;
|
||||||
int compare(size_type pos1, size_type n1, basic_string_view<charT, traits> sv) const;
|
template <class T>
|
||||||
|
int compare(size_type pos1, size_type n1, const T& t) const; // C++17
|
||||||
int compare(size_type pos1, size_type n1, const basic_string& str,
|
int compare(size_type pos1, size_type n1, const basic_string& str,
|
||||||
size_type pos2, size_type n2=npos) const; // C++14
|
size_type pos2, size_type n2=npos) const; // C++14
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -665,6 +681,7 @@ public:
|
|||||||
"traits_type::char_type must be the same type as CharT");
|
"traits_type::char_type must be the same type as CharT");
|
||||||
static_assert(( is_same<typename allocator_type::value_type, value_type>::value),
|
static_assert(( is_same<typename allocator_type::value_type, value_type>::value),
|
||||||
"Allocator::value_type must be same type as value_type");
|
"Allocator::value_type must be same type as value_type");
|
||||||
|
|
||||||
#if defined(_LIBCPP_RAW_ITERATORS)
|
#if defined(_LIBCPP_RAW_ITERATORS)
|
||||||
typedef pointer iterator;
|
typedef pointer iterator;
|
||||||
typedef const_pointer const_iterator;
|
typedef const_pointer const_iterator;
|
||||||
@@ -788,31 +805,45 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string(basic_string&& __str, const allocator_type& __a);
|
basic_string(basic_string&& __str, const allocator_type& __a);
|
||||||
#endif // _LIBCPP_CXX03_LANG
|
#endif // _LIBCPP_CXX03_LANG
|
||||||
_LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s);
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
|
||||||
basic_string(const _CharT* __s, const _Allocator& __a);
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_string(const _CharT* __s);
|
||||||
|
|
||||||
|
template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_string(const _CharT* __s, const _Allocator& __a);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string(const _CharT* __s, size_type __n);
|
basic_string(const _CharT* __s, size_type __n);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string(const _CharT* __s, size_type __n, const _Allocator& __a);
|
basic_string(const _CharT* __s, size_type __n, const _Allocator& __a);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string(size_type __n, _CharT __c);
|
basic_string(size_type __n, _CharT __c);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string(size_type __n, _CharT __c, const _Allocator& __a);
|
template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_string(size_type __n, _CharT __c, const _Allocator& __a);
|
||||||
|
|
||||||
basic_string(const basic_string& __str, size_type __pos, size_type __n,
|
basic_string(const basic_string& __str, size_type __pos, size_type __n,
|
||||||
const _Allocator& __a = _Allocator());
|
const _Allocator& __a = _Allocator());
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string(const basic_string& __str, size_type __pos,
|
basic_string(const basic_string& __str, size_type __pos,
|
||||||
const _Allocator& __a = _Allocator());
|
const _Allocator& __a = _Allocator());
|
||||||
template<class _Tp>
|
|
||||||
|
template<class _Tp, class = typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type>
|
||||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
basic_string(const _Tp& __t, size_type __pos, size_type __n,
|
basic_string(const _Tp& __t, size_type __pos, size_type __n,
|
||||||
const allocator_type& __a = allocator_type(),
|
const allocator_type& __a = allocator_type());
|
||||||
typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type* = 0);
|
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit
|
template<class _Tp, class = typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type>
|
||||||
basic_string(__self_view __sv);
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
explicit basic_string(const _Tp& __t);
|
||||||
basic_string(__self_view __sv, const _Allocator& __a);
|
|
||||||
|
template<class _Tp, class = typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
explicit basic_string(const _Tp& __t, const allocator_type& __a);
|
||||||
|
|
||||||
template<class _InputIterator>
|
template<class _InputIterator>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string(_InputIterator __first, _InputIterator __last);
|
basic_string(_InputIterator __first, _InputIterator __last);
|
||||||
@@ -833,11 +864,10 @@ public:
|
|||||||
|
|
||||||
basic_string& operator=(const basic_string& __str);
|
basic_string& operator=(const basic_string& __str);
|
||||||
|
|
||||||
#ifndef _LIBCPP_CXX03_LANG
|
template <class _Tp, class = typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type>
|
||||||
template <class = void>
|
basic_string& operator=(const _Tp& __t)
|
||||||
#endif
|
{__self_view __sv = __t; return assign(__sv);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string& operator=(__self_view __sv) {return assign(__sv);}
|
|
||||||
#ifndef _LIBCPP_CXX03_LANG
|
#ifndef _LIBCPP_CXX03_LANG
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string& operator=(basic_string&& __str)
|
basic_string& operator=(basic_string&& __str)
|
||||||
@@ -927,7 +957,15 @@ public:
|
|||||||
reference at(size_type __n);
|
reference at(size_type __n);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const basic_string& __str) {return append(__str);}
|
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const basic_string& __str) {return append(__str);}
|
||||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(__self_view __sv) {return append(__sv);}
|
|
||||||
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
basic_string&
|
||||||
|
>::type
|
||||||
|
operator+=(const _Tp& __t) {__self_view __sv = __t; return append(__sv);}
|
||||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s) {return append(__s);}
|
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s) {return append(__s);}
|
||||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
|
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
|
||||||
#ifndef _LIBCPP_CXX03_LANG
|
#ifndef _LIBCPP_CXX03_LANG
|
||||||
@@ -936,9 +974,17 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string& append(const basic_string& __str);
|
basic_string& append(const basic_string& __str);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string& append(__self_view __sv) { return append(__sv.data(), __sv.size()); }
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
basic_string&
|
||||||
|
>::type
|
||||||
|
append(const _Tp& __t) { __self_view __sv = __t; return append(__sv.data(), __sv.size()); }
|
||||||
basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
|
basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
typename enable_if
|
typename enable_if
|
||||||
@@ -993,8 +1039,14 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY reference back();
|
_LIBCPP_INLINE_VISIBILITY reference back();
|
||||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const;
|
_LIBCPP_INLINE_VISIBILITY const_reference back() const;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
template <class _Tp>
|
||||||
basic_string& assign(__self_view __sv) { return assign(__sv.data(), __sv.size()); }
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
basic_string&
|
||||||
|
>::type
|
||||||
|
assign(const _Tp & __t) { __self_view __sv = __t; return assign(__sv.data(), __sv.size()); }
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string& assign(const basic_string& __str) { return *this = __str; }
|
basic_string& assign(const basic_string& __str) { return *this = __str; }
|
||||||
#ifndef _LIBCPP_CXX03_LANG
|
#ifndef _LIBCPP_CXX03_LANG
|
||||||
@@ -1040,8 +1092,17 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string& insert(size_type __pos1, const basic_string& __str);
|
basic_string& insert(size_type __pos1, const basic_string& __str);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string& insert(size_type __pos1, __self_view __sv) { return insert(__pos1, __sv.data(), __sv.size()); }
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
basic_string&
|
||||||
|
>::type
|
||||||
|
insert(size_type __pos1, const _Tp& __t)
|
||||||
|
{ __self_view __sv = __t; return insert(__pos1, __sv.data(), __sv.size()); }
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
typename enable_if
|
typename enable_if
|
||||||
@@ -1089,8 +1150,15 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_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);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string& replace(size_type __pos1, size_type __n1, __self_view __sv) { return replace(__pos1, __n1, __sv.data(), __sv.size()); }
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
basic_string&
|
||||||
|
>::type
|
||||||
|
replace(size_type __pos1, size_type __n1, const _Tp& __t) { __self_view __sv = __t; return replace(__pos1, __n1, __sv.data(), __sv.size()); }
|
||||||
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 __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
@@ -1105,8 +1173,16 @@ public:
|
|||||||
basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
|
basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
|
basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string& replace(const_iterator __i1, const_iterator __i2, __self_view __sv) { return replace(__i1 - begin(), __i2 - __i1, __sv); }
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
basic_string&
|
||||||
|
>::type
|
||||||
|
replace(const_iterator __i1, const_iterator __i2, const _Tp& __t) { __self_view __sv = __t; return replace(__i1 - begin(), __i2 - __i1, __sv); }
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n);
|
basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -1154,8 +1230,15 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find(__self_view __sv, size_type __pos = 0) const _NOEXCEPT;
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
size_type
|
||||||
|
>::type
|
||||||
|
find(const _Tp& __t, size_type __pos = 0) const;
|
||||||
size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
||||||
@@ -1163,8 +1246,15 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type rfind(__self_view __sv, size_type __pos = npos) const _NOEXCEPT;
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
size_type
|
||||||
|
>::type
|
||||||
|
rfind(const _Tp& __t, size_type __pos = npos) const;
|
||||||
size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
||||||
@@ -1172,8 +1262,15 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_first_of(__self_view __sv, size_type __pos = 0) const _NOEXCEPT;
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
size_type
|
||||||
|
>::type
|
||||||
|
find_first_of(const _Tp& __t, size_type __pos = 0) const;
|
||||||
size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
||||||
@@ -1182,8 +1279,15 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_last_of(__self_view __sv, size_type __pos = npos) const _NOEXCEPT;
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
size_type
|
||||||
|
>::type
|
||||||
|
find_last_of(const _Tp& __t, size_type __pos = npos) const;
|
||||||
size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
||||||
@@ -1192,8 +1296,15 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_first_not_of(__self_view __sv, size_type __pos = 0) const _NOEXCEPT;
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
size_type
|
||||||
|
>::type
|
||||||
|
find_first_not_of(const _Tp &__t, size_type __pos = 0) const;
|
||||||
size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
||||||
@@ -1202,8 +1313,15 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_last_not_of(__self_view __sv, size_type __pos = npos) const _NOEXCEPT;
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
size_type
|
||||||
|
>::type
|
||||||
|
find_last_not_of(const _Tp& __t, size_type __pos = npos) const;
|
||||||
size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
||||||
@@ -1212,13 +1330,29 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
int compare(const basic_string& __str) const _NOEXCEPT;
|
int compare(const basic_string& __str) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
int compare(__self_view __sv) const _NOEXCEPT;
|
template <class _Tp>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
int compare(size_type __pos1, size_type __n1, __self_view __sv) const;
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
int
|
||||||
|
>::type
|
||||||
|
compare(const _Tp &__t) const;
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
int
|
||||||
|
>::type
|
||||||
|
compare(size_type __pos1, size_type __n1, const _Tp& __t) const;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_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) const;
|
||||||
int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos) const;
|
int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos) const;
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename enable_if
|
typename enable_if
|
||||||
@@ -1503,6 +1637,23 @@ template<class _InputIterator,
|
|||||||
>
|
>
|
||||||
basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
|
basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
|
||||||
-> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
|
-> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
|
||||||
|
|
||||||
|
template<class _CharT,
|
||||||
|
class _Traits,
|
||||||
|
class _Allocator = allocator<_CharT>,
|
||||||
|
class = typename enable_if<__is_allocator<_Allocator>::value, void>::type
|
||||||
|
>
|
||||||
|
explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _Allocator())
|
||||||
|
-> basic_string<_CharT, _Traits, _Allocator>;
|
||||||
|
|
||||||
|
template<class _CharT,
|
||||||
|
class _Traits,
|
||||||
|
class _Allocator = allocator<_CharT>,
|
||||||
|
class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
|
||||||
|
class _Sz = typename allocator_traits<_Allocator>::size_type
|
||||||
|
>
|
||||||
|
basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _Allocator())
|
||||||
|
-> basic_string<_CharT, _Traits, _Allocator>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -1623,7 +1774,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class>
|
||||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s)
|
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s)
|
||||||
{
|
{
|
||||||
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
|
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
|
||||||
@@ -1634,7 +1785,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class>
|
||||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
|
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
|
||||||
: __r_(__second_tag(), __a)
|
: __r_(__second_tag(), __a)
|
||||||
{
|
{
|
||||||
@@ -1771,7 +1922,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class>
|
||||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
|
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
|
||||||
: __r_(__second_tag(), __a)
|
: __r_(__second_tag(), __a)
|
||||||
{
|
{
|
||||||
@@ -1812,13 +1963,13 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
template <class _Tp>
|
template <class _Tp, class>
|
||||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||||
const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a,
|
const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a)
|
||||||
typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type *)
|
|
||||||
: __r_(__second_tag(), __a)
|
: __r_(__second_tag(), __a)
|
||||||
{
|
{
|
||||||
__self_view __sv = __self_view(__t).substr(__pos, __n);
|
__self_view __sv0 = __t;
|
||||||
|
__self_view __sv = __sv0.substr(__pos, __n);
|
||||||
__init(__sv.data(), __sv.size());
|
__init(__sv.data(), __sv.size());
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
__get_db()->__insert_c(this);
|
__get_db()->__insert_c(this);
|
||||||
@@ -1826,9 +1977,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class _Tp, class>
|
||||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv)
|
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
|
||||||
{
|
{
|
||||||
|
__self_view __sv = __t;
|
||||||
__init(__sv.data(), __sv.size());
|
__init(__sv.data(), __sv.size());
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
__get_db()->__insert_c(this);
|
__get_db()->__insert_c(this);
|
||||||
@@ -1836,10 +1988,11 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class _Tp, class>
|
||||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv, const _Allocator& __a)
|
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a)
|
||||||
: __r_(__second_tag(), __a)
|
: __r_(__second_tag(), __a)
|
||||||
{
|
{
|
||||||
|
__self_view __sv = __t;
|
||||||
__init(__sv.data(), __sv.size());
|
__init(__sv.data(), __sv.size());
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
__get_db()->__insert_c(this);
|
__get_db()->__insert_c(this);
|
||||||
@@ -3149,11 +3302,16 @@ basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _CharT, class _Traits, class _Allocator>
|
template<class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class _Tp>
|
||||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
typename enable_if
|
||||||
basic_string<_CharT, _Traits, _Allocator>::find(__self_view __sv,
|
<
|
||||||
size_type __pos) const _NOEXCEPT
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||||
|
>::type
|
||||||
|
basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t,
|
||||||
|
size_type __pos) const
|
||||||
{
|
{
|
||||||
|
__self_view __sv = __t;
|
||||||
return __str_find<value_type, size_type, traits_type, npos>
|
return __str_find<value_type, size_type, traits_type, npos>
|
||||||
(data(), size(), __sv.data(), __pos, __sv.size());
|
(data(), size(), __sv.data(), __pos, __sv.size());
|
||||||
}
|
}
|
||||||
@@ -3202,11 +3360,16 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _CharT, class _Traits, class _Allocator>
|
template<class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class _Tp>
|
||||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
typename enable_if
|
||||||
basic_string<_CharT, _Traits, _Allocator>::rfind(__self_view __sv,
|
<
|
||||||
size_type __pos) const _NOEXCEPT
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||||
|
>::type
|
||||||
|
basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t,
|
||||||
|
size_type __pos) const
|
||||||
{
|
{
|
||||||
|
__self_view __sv = __t;
|
||||||
return __str_rfind<value_type, size_type, traits_type, npos>
|
return __str_rfind<value_type, size_type, traits_type, npos>
|
||||||
(data(), size(), __sv.data(), __pos, __sv.size());
|
(data(), size(), __sv.data(), __pos, __sv.size());
|
||||||
}
|
}
|
||||||
@@ -3255,11 +3418,16 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __s
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _CharT, class _Traits, class _Allocator>
|
template<class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class _Tp>
|
||||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
typename enable_if
|
||||||
basic_string<_CharT, _Traits, _Allocator>::find_first_of(__self_view __sv,
|
<
|
||||||
size_type __pos) const _NOEXCEPT
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||||
|
>::type
|
||||||
|
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t,
|
||||||
|
size_type __pos) const
|
||||||
{
|
{
|
||||||
|
__self_view __sv = __t;
|
||||||
return __str_find_first_of<value_type, size_type, traits_type, npos>
|
return __str_find_first_of<value_type, size_type, traits_type, npos>
|
||||||
(data(), size(), __sv.data(), __pos, __sv.size());
|
(data(), size(), __sv.data(), __pos, __sv.size());
|
||||||
}
|
}
|
||||||
@@ -3308,11 +3476,16 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __st
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _CharT, class _Traits, class _Allocator>
|
template<class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class _Tp>
|
||||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
typename enable_if
|
||||||
basic_string<_CharT, _Traits, _Allocator>::find_last_of(__self_view __sv,
|
<
|
||||||
size_type __pos) const _NOEXCEPT
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||||
|
>::type
|
||||||
|
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t,
|
||||||
|
size_type __pos) const
|
||||||
{
|
{
|
||||||
|
__self_view __sv = __t;
|
||||||
return __str_find_last_of<value_type, size_type, traits_type, npos>
|
return __str_find_last_of<value_type, size_type, traits_type, npos>
|
||||||
(data(), size(), __sv.data(), __pos, __sv.size());
|
(data(), size(), __sv.data(), __pos, __sv.size());
|
||||||
}
|
}
|
||||||
@@ -3361,11 +3534,16 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string&
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _CharT, class _Traits, class _Allocator>
|
template<class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class _Tp>
|
||||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
typename enable_if
|
||||||
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(__self_view __sv,
|
<
|
||||||
size_type __pos) const _NOEXCEPT
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||||
|
>::type
|
||||||
|
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t,
|
||||||
|
size_type __pos) const
|
||||||
{
|
{
|
||||||
|
__self_view __sv = __t;
|
||||||
return __str_find_first_not_of<value_type, size_type, traits_type, npos>
|
return __str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||||
(data(), size(), __sv.data(), __pos, __sv.size());
|
(data(), size(), __sv.data(), __pos, __sv.size());
|
||||||
}
|
}
|
||||||
@@ -3415,11 +3593,16 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string&
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _CharT, class _Traits, class _Allocator>
|
template<class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class _Tp>
|
||||||
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
typename enable_if
|
||||||
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(__self_view __sv,
|
<
|
||||||
size_type __pos) const _NOEXCEPT
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||||
|
>::type
|
||||||
|
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t,
|
||||||
|
size_type __pos) const
|
||||||
{
|
{
|
||||||
|
__self_view __sv = __t;
|
||||||
return __str_find_last_not_of<value_type, size_type, traits_type, npos>
|
return __str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||||
(data(), size(), __sv.data(), __pos, __sv.size());
|
(data(), size(), __sv.data(), __pos, __sv.size());
|
||||||
}
|
}
|
||||||
@@ -3448,10 +3631,15 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
|
|||||||
// compare
|
// compare
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class _Tp>
|
||||||
int
|
typename enable_if
|
||||||
basic_string<_CharT, _Traits, _Allocator>::compare(__self_view __sv) const _NOEXCEPT
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
int
|
||||||
|
>::type
|
||||||
|
basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const
|
||||||
{
|
{
|
||||||
|
__self_view __sv = __t;
|
||||||
size_t __lhs_sz = size();
|
size_t __lhs_sz = size();
|
||||||
size_t __rhs_sz = __sv.size();
|
size_t __rhs_sz = __sv.size();
|
||||||
int __result = traits_type::compare(data(), __sv.data(),
|
int __result = traits_type::compare(data(), __sv.data(),
|
||||||
@@ -3497,12 +3685,17 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
template <class _Tp>
|
||||||
int
|
typename enable_if
|
||||||
|
<
|
||||||
|
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||||
|
int
|
||||||
|
>::type
|
||||||
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
|
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
|
||||||
size_type __n1,
|
size_type __n1,
|
||||||
__self_view __sv) const
|
const _Tp& __t) const
|
||||||
{
|
{
|
||||||
|
__self_view __sv = __t;
|
||||||
return compare(__pos1, __n1, __sv.data(), __sv.size());
|
return compare(__pos1, __n1, __sv.data(), __sv.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,4 +68,13 @@ int main()
|
|||||||
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
|
S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s;
|
||||||
|
s = {"abc", 1};
|
||||||
|
assert(s.size() == 1);
|
||||||
|
assert(s == "a");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,6 @@
|
|||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
#include "test_allocator.h"
|
#include "test_allocator.h"
|
||||||
|
|
||||||
template <class T>
|
|
||||||
struct some_alloc
|
|
||||||
{
|
|
||||||
typedef T value_type;
|
|
||||||
some_alloc(const some_alloc&);
|
|
||||||
};
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -40,7 +33,7 @@ int main()
|
|||||||
static_assert(std::is_nothrow_default_constructible<C>::value, "");
|
static_assert(std::is_nothrow_default_constructible<C>::value, "");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
|
typedef std::basic_string<char, std::char_traits<char>, limited_allocator<char, 10>> C;
|
||||||
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
|
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,12 @@
|
|||||||
#include "test_allocator.h"
|
#include "test_allocator.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct some_alloc
|
struct throwing_alloc
|
||||||
{
|
{
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
some_alloc(const some_alloc&);
|
throwing_alloc(const throwing_alloc&);
|
||||||
~some_alloc() noexcept(false);
|
T *allocate(size_t);
|
||||||
|
~throwing_alloc() noexcept(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Test that it's possible to take the address of basic_string's destructors
|
// Test that it's possible to take the address of basic_string's destructors
|
||||||
@@ -44,7 +45,7 @@ int main()
|
|||||||
}
|
}
|
||||||
#if defined(_LIBCPP_VERSION)
|
#if defined(_LIBCPP_VERSION)
|
||||||
{
|
{
|
||||||
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
|
typedef std::basic_string<char, std::char_traits<char>, throwing_alloc<char>> C;
|
||||||
static_assert(!std::is_nothrow_destructible<C>::value, "");
|
static_assert(!std::is_nothrow_destructible<C>::value, "");
|
||||||
}
|
}
|
||||||
#endif // _LIBCPP_VERSION
|
#endif // _LIBCPP_VERSION
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ using BStr = std::basic_string<T, std::char_traits<T>, Alloc>;
|
|||||||
// (2) basic_string(A const&) - BROKEN
|
// (2) basic_string(A const&) - BROKEN
|
||||||
// (3) basic_string(size_type, CharT, const A& = A())
|
// (3) basic_string(size_type, CharT, const A& = A())
|
||||||
// (4) basic_string(BS const&, size_type, A const& = A())
|
// (4) basic_string(BS const&, size_type, A const& = A())
|
||||||
// (5) basic_string(BS const&, size_type, size_type, A const& = A()) - PARTIALLY BROKEN
|
// (5) basic_string(BS const&, size_type, size_type, A const& = A())
|
||||||
// (6) basic_string(const CharT*, size_type, A const& = A())
|
// (6) basic_string(const CharT*, size_type, A const& = A())
|
||||||
// (7) basic_string(const CharT*, A const& = A())
|
// (7) basic_string(const CharT*, A const& = A())
|
||||||
// (8) basic_string(InputIt, InputIt, A const& = A()) - BROKEN
|
// (8) basic_string(InputIt, InputIt, A const& = A()) - BROKEN
|
||||||
@@ -46,7 +46,7 @@ using BStr = std::basic_string<T, std::char_traits<T>, Alloc>;
|
|||||||
// (12) basic_string(BS&&, A const&)
|
// (12) basic_string(BS&&, A const&)
|
||||||
// (13) basic_string(initializer_list<CharT>, A const& = A())
|
// (13) basic_string(initializer_list<CharT>, A const& = A())
|
||||||
// (14) basic_string(BSV, A const& = A())
|
// (14) basic_string(BSV, A const& = A())
|
||||||
// (15) basic_string(const T&, size_type, size_type, A const& = A()) - BROKEN
|
// (15) basic_string(const T&, size_type, size_type, A const& = A())
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
using TestSizeT = test_allocator<char>::size_type;
|
using TestSizeT = test_allocator<char>::size_type;
|
||||||
@@ -106,7 +106,6 @@ int main()
|
|||||||
assert(w == L"def");
|
assert(w == L"def");
|
||||||
}
|
}
|
||||||
{ // Testing (5) w/o allocator
|
{ // Testing (5) w/o allocator
|
||||||
#if 0 // FIXME: This doesn't work
|
|
||||||
const std::string sin("abc");
|
const std::string sin("abc");
|
||||||
std::basic_string s(sin, (size_t)1, (size_t)3);
|
std::basic_string s(sin, (size_t)1, (size_t)3);
|
||||||
ASSERT_SAME_TYPE(decltype(s), std::string);
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
||||||
@@ -119,7 +118,6 @@ int main()
|
|||||||
std::basic_string w(win, (TestSizeT)2, (TestSizeT)3);
|
std::basic_string w(win, (TestSizeT)2, (TestSizeT)3);
|
||||||
ASSERT_SAME_TYPE(decltype(w), WStr);
|
ASSERT_SAME_TYPE(decltype(w), WStr);
|
||||||
assert(w == L"cde");
|
assert(w == L"cde");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
{ // Testing (5) w/ allocator
|
{ // Testing (5) w/ allocator
|
||||||
const std::string sin("abc");
|
const std::string sin("abc");
|
||||||
@@ -178,20 +176,19 @@ int main()
|
|||||||
assert(w == L"abcdef");
|
assert(w == L"abcdef");
|
||||||
}
|
}
|
||||||
{ // (8) w/o allocator
|
{ // (8) w/o allocator
|
||||||
// This overload isn't compatible with implicit deduction guides as
|
|
||||||
// specified in the standard.
|
|
||||||
// FIXME: Propose adding an explicit guide to the standard?
|
|
||||||
}
|
|
||||||
{ // (8) w/ allocator
|
|
||||||
// This overload isn't compatible with implicit deduction guides as
|
|
||||||
// specified in the standard.
|
|
||||||
// FIXME: Propose adding an explicit guide to the standard?
|
|
||||||
#if 0
|
|
||||||
using It = input_iterator<const char*>;
|
using It = input_iterator<const char*>;
|
||||||
const char* input = "abcdef";
|
const char* input = "abcdef";
|
||||||
std::basic_string s(It(input), It(input + 3), std::allocator<char>{});
|
std::basic_string s(It(input), It(input + 3), std::allocator<char>{});
|
||||||
ASSERT_SAME_TYPE(decltype(s), std::string);
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
||||||
#endif
|
assert(s == "abc");
|
||||||
|
}
|
||||||
|
{ // (8) w/ allocator
|
||||||
|
using ExpectW = std::basic_string<wchar_t, std::char_traits<wchar_t>, test_allocator<wchar_t>>;
|
||||||
|
using It = input_iterator<const wchar_t*>;
|
||||||
|
const wchar_t* input = L"abcdef";
|
||||||
|
std::basic_string s(It(input), It(input + 3), test_allocator<wchar_t>{});
|
||||||
|
ASSERT_SAME_TYPE(decltype(s), ExpectW);
|
||||||
|
assert(s == L"abc");
|
||||||
}
|
}
|
||||||
{ // Testing (9)
|
{ // Testing (9)
|
||||||
const std::string sin("abc");
|
const std::string sin("abc");
|
||||||
@@ -293,8 +290,28 @@ int main()
|
|||||||
ASSERT_SAME_TYPE(decltype(w), ExpectW);
|
ASSERT_SAME_TYPE(decltype(w), ExpectW);
|
||||||
assert(w == L"abcdef");
|
assert(w == L"abcdef");
|
||||||
}
|
}
|
||||||
{ // Testing (15)
|
{ // Testing (15) w/o allocator
|
||||||
// This overload isn't compatible with implicit deduction guides as
|
std::string s0("abc");
|
||||||
// specified in the standard.
|
std::basic_string s(s0, 1, 1);
|
||||||
|
ASSERT_SAME_TYPE(decltype(s), std::string);
|
||||||
|
assert(s == "b");
|
||||||
|
|
||||||
|
std::wstring w0(L"abcdef");
|
||||||
|
std::basic_string w(w0, 2, 2);
|
||||||
|
ASSERT_SAME_TYPE(decltype(w), std::wstring);
|
||||||
|
assert(w == L"cd");
|
||||||
|
}
|
||||||
|
{ // Testing (15) w/ allocator
|
||||||
|
using ExpectS = std::basic_string<char, std::char_traits<char>, test_allocator<char>>;
|
||||||
|
ExpectS s0("abc");
|
||||||
|
std::basic_string s(s0, 1, 1, test_allocator<char>{4});
|
||||||
|
ASSERT_SAME_TYPE(decltype(s), ExpectS);
|
||||||
|
assert(s == "b");
|
||||||
|
|
||||||
|
using ExpectW = std::basic_string<wchar_t, std::char_traits<wchar_t>, test_allocator<wchar_t>>;
|
||||||
|
ExpectW w0(L"abcdef");
|
||||||
|
std::basic_string w(w0, 2, 2, test_allocator<wchar_t>{6});
|
||||||
|
ASSERT_SAME_TYPE(decltype(w), ExpectW);
|
||||||
|
assert(w == L"cd");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ struct some_alloc
|
|||||||
{
|
{
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
some_alloc(const some_alloc&);
|
some_alloc(const some_alloc&);
|
||||||
|
T *allocate(size_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -41,6 +42,7 @@ struct some_alloc2
|
|||||||
|
|
||||||
some_alloc2() {}
|
some_alloc2() {}
|
||||||
some_alloc2(const some_alloc2&);
|
some_alloc2(const some_alloc2&);
|
||||||
|
T *allocate(size_t);
|
||||||
void deallocate(void*, unsigned) {}
|
void deallocate(void*, unsigned) {}
|
||||||
|
|
||||||
typedef std::false_type propagate_on_container_move_assignment;
|
typedef std::false_type propagate_on_container_move_assignment;
|
||||||
@@ -54,6 +56,7 @@ struct some_alloc3
|
|||||||
|
|
||||||
some_alloc3() {}
|
some_alloc3() {}
|
||||||
some_alloc3(const some_alloc3&);
|
some_alloc3(const some_alloc3&);
|
||||||
|
T *allocate(size_t);
|
||||||
void deallocate(void*, unsigned) {}
|
void deallocate(void*, unsigned) {}
|
||||||
|
|
||||||
typedef std::false_type propagate_on_container_move_assignment;
|
typedef std::false_type propagate_on_container_move_assignment;
|
||||||
|
|||||||
@@ -22,13 +22,6 @@
|
|||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
#include "test_allocator.h"
|
#include "test_allocator.h"
|
||||||
|
|
||||||
template <class T>
|
|
||||||
struct some_alloc
|
|
||||||
{
|
|
||||||
typedef T value_type;
|
|
||||||
some_alloc(const some_alloc&);
|
|
||||||
};
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -40,7 +33,7 @@ int main()
|
|||||||
static_assert(std::is_nothrow_move_constructible<C>::value, "");
|
static_assert(std::is_nothrow_move_constructible<C>::value, "");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
|
typedef std::basic_string<char, std::char_traits<char>, limited_allocator<char, 10>> C;
|
||||||
#if TEST_STD_VER <= 14
|
#if TEST_STD_VER <= 14
|
||||||
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
|
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -83,4 +83,12 @@ int main()
|
|||||||
test("123456798012345679801234567980123456798012345679801234567980", 60, A());
|
test("123456798012345679801234567980123456798012345679801234567980", 60, A());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s({"abc", 1});
|
||||||
|
assert(s.size() == 1);
|
||||||
|
assert(s == "a");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// <string>
|
||||||
|
// UNSUPPORTED: c++98, c++03, c++11, c++14
|
||||||
|
// XFAIL: libcpp-no-deduction-guides
|
||||||
|
|
||||||
|
// template<class InputIterator>
|
||||||
|
// basic_string(InputIterator begin, InputIterator end,
|
||||||
|
// const Allocator& a = Allocator());
|
||||||
|
|
||||||
|
// template<class charT,
|
||||||
|
// class traits,
|
||||||
|
// class Allocator = allocator<charT>
|
||||||
|
// >
|
||||||
|
// basic_string(basic_string_view<charT, traits>, const Allocator& = Allocator())
|
||||||
|
// -> basic_string<charT, traits, Allocator>;
|
||||||
|
//
|
||||||
|
// The deduction guide shall not participate in overload resolution if Allocator
|
||||||
|
// is a type that does not qualify as an allocator.
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <iterator>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
std::string_view sv = "12345678901234";
|
||||||
|
std::basic_string s1{sv, 23}; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_string'}}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// <string>
|
||||||
|
// UNSUPPORTED: c++98, c++03, c++11, c++14
|
||||||
|
// XFAIL: libcpp-no-deduction-guides
|
||||||
|
|
||||||
|
// template<class InputIterator>
|
||||||
|
// basic_string(InputIterator begin, InputIterator end,
|
||||||
|
// const Allocator& a = Allocator());
|
||||||
|
|
||||||
|
// template<class charT,
|
||||||
|
// class traits,
|
||||||
|
// class Allocator = allocator<charT>
|
||||||
|
// >
|
||||||
|
// basic_string(basic_string_view<charT, traits>, const Allocator& = Allocator())
|
||||||
|
// -> basic_string<charT, traits, Allocator>;
|
||||||
|
//
|
||||||
|
// The deduction guide shall not participate in overload resolution if Allocator
|
||||||
|
// is a type that does not qualify as an allocator.
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <iterator>
|
||||||
|
#include <memory>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
#include "test_allocator.h"
|
||||||
|
#include "../input_iterator.h"
|
||||||
|
#include "min_allocator.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
std::string_view sv = "12345678901234";
|
||||||
|
std::basic_string s1(sv);
|
||||||
|
using S = decltype(s1); // what type did we get?
|
||||||
|
static_assert(std::is_same_v<S::value_type, char>, "");
|
||||||
|
static_assert(std::is_same_v<S::traits_type, std::char_traits<char>>, "");
|
||||||
|
static_assert(std::is_same_v<S::allocator_type, std::allocator<char>>, "");
|
||||||
|
assert(s1.size() == sv.size());
|
||||||
|
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::string_view sv = "12345678901234";
|
||||||
|
std::basic_string s1{sv, std::allocator<char>{}};
|
||||||
|
using S = decltype(s1); // what type did we get?
|
||||||
|
static_assert(std::is_same_v<S::value_type, char>, "");
|
||||||
|
static_assert(std::is_same_v<S::traits_type, std::char_traits<char>>, "");
|
||||||
|
static_assert(std::is_same_v<S::allocator_type, std::allocator<char>>, "");
|
||||||
|
assert(s1.size() == sv.size());
|
||||||
|
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::wstring_view sv = L"12345678901234";
|
||||||
|
std::basic_string s1{sv, test_allocator<wchar_t>{}};
|
||||||
|
using S = decltype(s1); // what type did we get?
|
||||||
|
static_assert(std::is_same_v<S::value_type, wchar_t>, "");
|
||||||
|
static_assert(std::is_same_v<S::traits_type, std::char_traits<wchar_t>>, "");
|
||||||
|
static_assert(std::is_same_v<S::allocator_type, test_allocator<wchar_t>>, "");
|
||||||
|
assert(s1.size() == sv.size());
|
||||||
|
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::u16string_view sv = u"12345678901234";
|
||||||
|
std::basic_string s1{sv, min_allocator<char16_t>{}};
|
||||||
|
using S = decltype(s1); // what type did we get?
|
||||||
|
static_assert(std::is_same_v<S::value_type, char16_t>, "");
|
||||||
|
static_assert(std::is_same_v<S::traits_type, std::char_traits<char16_t>>, "");
|
||||||
|
static_assert(std::is_same_v<S::allocator_type, min_allocator<char16_t>>, "");
|
||||||
|
assert(s1.size() == sv.size());
|
||||||
|
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::u32string_view sv = U"12345678901234";
|
||||||
|
std::basic_string s1{sv, explicit_allocator<char32_t>{}};
|
||||||
|
using S = decltype(s1); // what type did we get?
|
||||||
|
static_assert(std::is_same_v<S::value_type, char32_t>, "");
|
||||||
|
static_assert(std::is_same_v<S::traits_type, std::char_traits<char32_t>>, "");
|
||||||
|
static_assert(std::is_same_v<S::allocator_type, explicit_allocator<char32_t>>, "");
|
||||||
|
assert(s1.size() == sv.size());
|
||||||
|
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// <string>
|
||||||
|
// UNSUPPORTED: c++98, c++03, c++11, c++14
|
||||||
|
// XFAIL: libcpp-no-deduction-guides
|
||||||
|
|
||||||
|
// template<class InputIterator>
|
||||||
|
// basic_string(InputIterator begin, InputIterator end,
|
||||||
|
// const Allocator& a = Allocator());
|
||||||
|
|
||||||
|
// template<class charT,
|
||||||
|
// class traits,
|
||||||
|
// class Allocator = allocator<charT>
|
||||||
|
// >
|
||||||
|
// basic_string(basic_string_view<charT, traits>,
|
||||||
|
// typename see below::size_type,
|
||||||
|
// typename see below::size_type,
|
||||||
|
// const Allocator& = Allocator())
|
||||||
|
// -> basic_string<charT, traits, Allocator>;
|
||||||
|
//
|
||||||
|
// A size_type parameter type in a basic_string deduction guide refers to the size_type
|
||||||
|
// member type of the type deduced by the deduction guide.
|
||||||
|
//
|
||||||
|
// The deduction guide shall not participate in overload resolution if Allocator
|
||||||
|
// is a type that does not qualify as an allocator.
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <iterator>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
std::string_view sv = "12345678901234";
|
||||||
|
std::basic_string s1{sv, 0, 4, 23}; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_string'}}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// <string>
|
||||||
|
// UNSUPPORTED: c++98, c++03, c++11, c++14
|
||||||
|
// XFAIL: libcpp-no-deduction-guides
|
||||||
|
|
||||||
|
// template<class InputIterator>
|
||||||
|
// basic_string(InputIterator begin, InputIterator end,
|
||||||
|
// const Allocator& a = Allocator());
|
||||||
|
|
||||||
|
// template<class charT,
|
||||||
|
// class traits,
|
||||||
|
// class Allocator = allocator<charT>
|
||||||
|
// >
|
||||||
|
// basic_string(basic_string_view<charT, traits>,
|
||||||
|
// typename see below::size_type,
|
||||||
|
// typename see below::size_type,
|
||||||
|
// const Allocator& = Allocator())
|
||||||
|
// -> basic_string<charT, traits, Allocator>;
|
||||||
|
//
|
||||||
|
// A size_type parameter type in a basic_string deduction guide refers to the size_type
|
||||||
|
// member type of the type deduced by the deduction guide.
|
||||||
|
//
|
||||||
|
// The deduction guide shall not participate in overload resolution if Allocator
|
||||||
|
// is a type that does not qualify as an allocator.
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <iterator>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
#include "test_allocator.h"
|
||||||
|
#include "../input_iterator.h"
|
||||||
|
#include "min_allocator.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
std::string_view sv = "12345678901234";
|
||||||
|
std::basic_string s1{sv, 0, 4};
|
||||||
|
using S = decltype(s1); // what type did we get?
|
||||||
|
static_assert(std::is_same_v<S::value_type, char>, "");
|
||||||
|
static_assert(std::is_same_v<S::traits_type, std::char_traits<char>>, "");
|
||||||
|
static_assert(std::is_same_v<S::allocator_type, std::allocator<char>>, "");
|
||||||
|
assert(s1.size() == 4);
|
||||||
|
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::string_view sv = "12345678901234";
|
||||||
|
std::basic_string s1{sv, 0, 4, std::allocator<char>{}};
|
||||||
|
using S = decltype(s1); // what type did we get?
|
||||||
|
static_assert(std::is_same_v<S::value_type, char>, "");
|
||||||
|
static_assert(std::is_same_v<S::traits_type, std::char_traits<char>>, "");
|
||||||
|
static_assert(std::is_same_v<S::allocator_type, std::allocator<char>>, "");
|
||||||
|
assert(s1.size() == 4);
|
||||||
|
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::wstring_view sv = L"12345678901234";
|
||||||
|
std::basic_string s1{sv, 0, 4, test_allocator<wchar_t>{}};
|
||||||
|
using S = decltype(s1); // what type did we get?
|
||||||
|
static_assert(std::is_same_v<S::value_type, wchar_t>, "");
|
||||||
|
static_assert(std::is_same_v<S::traits_type, std::char_traits<wchar_t>>, "");
|
||||||
|
static_assert(std::is_same_v<S::allocator_type, test_allocator<wchar_t>>, "");
|
||||||
|
assert(s1.size() == 4);
|
||||||
|
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::u16string_view sv = u"12345678901234";
|
||||||
|
std::basic_string s1{sv, 0, 4, min_allocator<char16_t>{}};
|
||||||
|
using S = decltype(s1); // what type did we get?
|
||||||
|
static_assert(std::is_same_v<S::value_type, char16_t>, "");
|
||||||
|
static_assert(std::is_same_v<S::traits_type, std::char_traits<char16_t>>, "");
|
||||||
|
static_assert(std::is_same_v<S::allocator_type, min_allocator<char16_t>>, "");
|
||||||
|
assert(s1.size() == 4);
|
||||||
|
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::u32string_view sv = U"12345678901234";
|
||||||
|
std::basic_string s1{sv, 0, 4, explicit_allocator<char32_t>{}};
|
||||||
|
using S = decltype(s1); // what type did we get?
|
||||||
|
static_assert(std::is_same_v<S::value_type, char32_t>, "");
|
||||||
|
static_assert(std::is_same_v<S::traits_type, std::char_traits<char32_t>>, "");
|
||||||
|
static_assert(std::is_same_v<S::allocator_type, explicit_allocator<char32_t>>, "");
|
||||||
|
assert(s1.size() == 4);
|
||||||
|
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -77,4 +77,13 @@ int main()
|
|||||||
S("1234567890123456789012345678901234567890"));
|
S("1234567890123456789012345678901234567890"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s;
|
||||||
|
s.append({"abc", 1});
|
||||||
|
assert(s.size() == 1);
|
||||||
|
assert(s == "a");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,4 +218,13 @@ int main()
|
|||||||
test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), S("can't happen"));
|
test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), S("can't happen"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s;
|
||||||
|
s.insert(0, {"abc", 1});
|
||||||
|
assert(s.size() == 1);
|
||||||
|
assert(s == "a");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,4 +77,13 @@ int main()
|
|||||||
S("1234567890123456789012345678901234567890"));
|
S("1234567890123456789012345678901234567890"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s;
|
||||||
|
s += {"abc", 1};
|
||||||
|
assert(s.size() == 1);
|
||||||
|
assert(s == "a");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,4 +281,13 @@ int main()
|
|||||||
test2<S>();
|
test2<S>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s = " ";
|
||||||
|
s.replace(s.cbegin(), s.cend(), {"abc", 1});
|
||||||
|
assert(s.size() == 1);
|
||||||
|
assert(s == "a");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -379,4 +379,13 @@ int main()
|
|||||||
test2<S>();
|
test2<S>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s = " ";
|
||||||
|
s.replace(0, 1, {"abc", 1});
|
||||||
|
assert(s.size() == 1);
|
||||||
|
assert(s == "a");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ struct some_alloc
|
|||||||
|
|
||||||
some_alloc() {}
|
some_alloc() {}
|
||||||
some_alloc(const some_alloc&);
|
some_alloc(const some_alloc&);
|
||||||
|
T *allocate(size_t);
|
||||||
void deallocate(void*, unsigned) {}
|
void deallocate(void*, unsigned) {}
|
||||||
|
|
||||||
typedef std::true_type propagate_on_container_swap;
|
typedef std::true_type propagate_on_container_swap;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -47,6 +47,7 @@ struct some_alloc2
|
|||||||
|
|
||||||
some_alloc2() {}
|
some_alloc2() {}
|
||||||
some_alloc2(const some_alloc2&);
|
some_alloc2(const some_alloc2&);
|
||||||
|
T *allocate(size_t);
|
||||||
void deallocate(void*, unsigned) {}
|
void deallocate(void*, unsigned) {}
|
||||||
|
|
||||||
typedef std::false_type propagate_on_container_swap;
|
typedef std::false_type propagate_on_container_swap;
|
||||||
|
|||||||
@@ -15,9 +15,8 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "min_allocator.h"
|
|
||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
#include "min_allocator.h"
|
||||||
|
|
||||||
int sign(int x)
|
int sign(int x)
|
||||||
{
|
{
|
||||||
@@ -378,4 +377,11 @@ int main()
|
|||||||
test2<S>();
|
test2<S>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s = " !";
|
||||||
|
assert(s.compare(0, 1, {"abc", 1}) < 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
#include "min_allocator.h"
|
#include "min_allocator.h"
|
||||||
|
|
||||||
int sign(int x)
|
int sign(int x)
|
||||||
@@ -74,4 +75,11 @@ int main()
|
|||||||
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), 0);
|
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s = " !";
|
||||||
|
assert(s.compare({"abc", 1}) < 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
#include "min_allocator.h"
|
#include "min_allocator.h"
|
||||||
|
|
||||||
template <class S>
|
template <class S>
|
||||||
@@ -154,4 +155,11 @@ int main()
|
|||||||
test1<S>();
|
test1<S>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s = " !";
|
||||||
|
assert(s.find_first_not_of({"abc", 1}) == 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
#include "min_allocator.h"
|
#include "min_allocator.h"
|
||||||
|
|
||||||
template <class S>
|
template <class S>
|
||||||
@@ -154,4 +155,11 @@ int main()
|
|||||||
test1<S>();
|
test1<S>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s = " !";
|
||||||
|
assert(s.find_first_of({"abc", 1}) == std::string::npos);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
#include "min_allocator.h"
|
#include "min_allocator.h"
|
||||||
|
|
||||||
template <class S>
|
template <class S>
|
||||||
@@ -154,4 +155,11 @@ int main()
|
|||||||
test1<S>();
|
test1<S>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s = " !";
|
||||||
|
assert(s.find_last_not_of({"abc", 1}) == s.size() - 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
#include "min_allocator.h"
|
#include "min_allocator.h"
|
||||||
|
|
||||||
template <class S>
|
template <class S>
|
||||||
@@ -154,4 +155,11 @@ int main()
|
|||||||
test1<S>();
|
test1<S>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s = " !";
|
||||||
|
assert(s.find_last_of({"abc", 1}) == std::string::npos);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
#include "min_allocator.h"
|
#include "min_allocator.h"
|
||||||
|
|
||||||
template <class S>
|
template <class S>
|
||||||
@@ -154,4 +155,11 @@ int main()
|
|||||||
test1<S>();
|
test1<S>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s = " !";
|
||||||
|
assert(s.find({"abc", 1}) == std::string::npos);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
#include "min_allocator.h"
|
#include "min_allocator.h"
|
||||||
|
|
||||||
template <class S>
|
template <class S>
|
||||||
@@ -154,4 +155,11 @@ int main()
|
|||||||
test1<S>();
|
test1<S>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER > 3
|
||||||
|
{ // LWG 2946
|
||||||
|
std::string s = " !";
|
||||||
|
assert(s.rfind({"abc", 1}) == std::string::npos);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@
|
|||||||
<tr><td><a href="https://wg21.link/LWG2843">2843</a></td><td>Unclear behavior of <tt>std::pmr::memory_resource::do_allocate()</tt></td><td>Jacksonville</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG2843">2843</a></td><td>Unclear behavior of <tt>std::pmr::memory_resource::do_allocate()</tt></td><td>Jacksonville</td><td></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG2849">2849</a></td><td>Why does <tt>!is_regular_file(from)</tt> cause <tt>copy_file</tt> to report a "file already exists" error?</td><td>Jacksonville</td><td><i>Nothing to do</i></td></tr>
|
<tr><td><a href="https://wg21.link/LWG2849">2849</a></td><td>Why does <tt>!is_regular_file(from)</tt> cause <tt>copy_file</tt> to report a "file already exists" error?</td><td>Jacksonville</td><td><i>Nothing to do</i></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG2851">2851</a></td><td><tt>std::filesystem</tt> enum classes are now underspecified</td><td>Jacksonville</td><td><i>Nothing to do</i></td></tr>
|
<tr><td><a href="https://wg21.link/LWG2851">2851</a></td><td><tt>std::filesystem</tt> enum classes are now underspecified</td><td>Jacksonville</td><td><i>Nothing to do</i></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG2946">2946</a></td><td>LWG 2758's resolution missed further corrections</td><td>Jacksonville</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG2946">2946</a></td><td>LWG 2758's resolution missed further corrections</td><td>Jacksonville</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG2969">2969</a></td><td><tt>polymorphic_allocator::construct()</tt> shouldn't pass <tt>resource()</tt></td><td>Jacksonville</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG2969">2969</a></td><td><tt>polymorphic_allocator::construct()</tt> shouldn't pass <tt>resource()</tt></td><td>Jacksonville</td><td></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG2975">2975</a></td><td>Missing case for <tt>pair</tt> construction in scoped and polymorphic allocators</td><td>Jacksonville</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG2975">2975</a></td><td>Missing case for <tt>pair</tt> construction in scoped and polymorphic allocators</td><td>Jacksonville</td><td></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG2989">2989</a></td><td><tt>path</tt>'s stream insertion operator lets you insert everything under the sun</td><td>Jacksonville</td><td>Completed</td></tr>
|
<tr><td><a href="https://wg21.link/LWG2989">2989</a></td><td><tt>path</tt>'s stream insertion operator lets you insert everything under the sun</td><td>Jacksonville</td><td>Completed</td></tr>
|
||||||
@@ -200,7 +200,7 @@
|
|||||||
<tr><td><a href="https://wg21.link/LWG3045">3045</a></td><td><tt>atomic<<i>floating-point</i>></tt> doesn't have <tt>value_type</tt> or <tt>difference_type</tt></td><td>Jacksonville</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3045">3045</a></td><td><tt>atomic<<i>floating-point</i>></tt> doesn't have <tt>value_type</tt> or <tt>difference_type</tt></td><td>Jacksonville</td><td></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG3048">3048</a></td><td><tt>transform_reduce(exec, first1, last1, first2, init)</tt> discards execution policy</td><td>Jacksonville</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3048">3048</a></td><td><tt>transform_reduce(exec, first1, last1, first2, init)</tt> discards execution policy</td><td>Jacksonville</td><td></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG3051">3051</a></td><td>Floating point classifications were inadvertently changed in P0175</td><td>Jacksonville</td><td><i>Nothing to do</i></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3051">3051</a></td><td>Floating point classifications were inadvertently changed in P0175</td><td>Jacksonville</td><td><i>Nothing to do</i></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG3075">3075</a></td><td><tt>basic_string</tt> needs deduction guides from <tt>basic_string_view</tt></td><td>Jacksonville</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3075">3075</a></td><td><tt>basic_string</tt> needs deduction guides from <tt>basic_string_view</tt></td><td>Jacksonville</td><td>Complete</td></tr>
|
||||||
|
|
||||||
<tr><td></td><td></td><td></td><td></td></tr>
|
<tr><td></td><td></td><td></td><td></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG2139">2139</a></td><td>What is a user-defined type?</td><td>Rapperswil</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG2139">2139</a></td><td>What is a user-defined type?</td><td>Rapperswil</td><td></td></tr>
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
<tr><td><a href="https://wg21.link/LWG3067">3067</a></td><td>recursive_directory_iterator::pop must invalidate</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3067">3067</a></td><td>recursive_directory_iterator::pop must invalidate</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG3071">3071</a></td><td>[networking.ts] read_until still refers to "input sequence"</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3071">3071</a></td><td>[networking.ts] read_until still refers to "input sequence"</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG3074">3074</a></td><td>Non-member functions for valarray should only deduce from the valarray</td><td>Rapperswil</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3074">3074</a></td><td>Non-member functions for valarray should only deduce from the valarray</td><td>Rapperswil</td><td></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG3076">3076</a></td><td>basic_string CTAD ambiguity</td><td>Rapperswil</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3076">3076</a></td><td>basic_string CTAD ambiguity</td><td>Rapperswil</td><td></td>Complete</tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG3079">3079</a></td><td>LWG 2935 forgot to fix the existing_p overloads of create_directory</td><td>Rapperswil</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3079">3079</a></td><td>LWG 2935 forgot to fix the existing_p overloads of create_directory</td><td>Rapperswil</td><td></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG3080">3080</a></td><td>Floating point from_chars pattern specification breaks round-tripping</td><td>Rapperswil</td><td></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3080">3080</a></td><td>Floating point from_chars pattern specification breaks round-tripping</td><td>Rapperswil</td><td></td></tr>
|
||||||
<tr><td><a href="https://wg21.link/LWG3083">3083</a></td><td>What should ios::iword(-1) do?</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
|
<tr><td><a href="https://wg21.link/LWG3083">3083</a></td><td>What should ios::iword(-1) do?</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user