зеркало из https://github.com/microsoft/STL.git
`string_view` must be `is_trivially_move_constructible_v` (#2128)
Co-authored-by: frederick-vs-ja <de34@live.cn> Co-authored-by: Adam Bucior <35536269+AdamBucior@users.noreply.github.com> Co-authored-by: Casey Carter <cartec69@gmail.com>
This commit is contained in:
Родитель
3ce4c8fcb9
Коммит
c2e3f098e5
|
@ -1274,8 +1274,10 @@ public:
|
|||
|
||||
#if _HAS_CXX23
|
||||
// clang-format off
|
||||
template <_RANGES contiguous_range _Range>
|
||||
requires (_RANGES sized_range<_Range>
|
||||
template <class _Range>
|
||||
requires (!same_as<remove_cvref_t<_Range>, basic_string_view> // per LWG issue filed on 2021-08-16
|
||||
&& _RANGES contiguous_range<_Range>
|
||||
&& _RANGES sized_range<_Range>
|
||||
&& same_as<_RANGES range_value_t<_Range>, _Elem>
|
||||
&& (!is_convertible_v<_Range, const _Elem*>)
|
||||
&& (!requires(remove_cvref_t<_Range>& _Rng) {
|
||||
|
|
|
@ -74,6 +74,19 @@ const evil_conversion_to_string_view_lvalue_only convert_lvalue_only{};
|
|||
static_assert(is_trivially_copyable_v<string_view>);
|
||||
static_assert(is_trivially_copyable_v<wstring_view>);
|
||||
|
||||
// Similar non-standard guarantees
|
||||
static_assert(is_trivially_move_constructible_v<string_view>);
|
||||
static_assert(is_trivially_copy_constructible_v<string_view>);
|
||||
static_assert(is_trivially_move_assignable_v<string_view>);
|
||||
static_assert(is_trivially_copy_assignable_v<string_view>);
|
||||
static_assert(is_trivially_destructible_v<string_view>);
|
||||
|
||||
static_assert(is_trivially_move_constructible_v<wstring_view>);
|
||||
static_assert(is_trivially_copy_constructible_v<wstring_view>);
|
||||
static_assert(is_trivially_move_assignable_v<wstring_view>);
|
||||
static_assert(is_trivially_copy_assignable_v<wstring_view>);
|
||||
static_assert(is_trivially_destructible_v<wstring_view>);
|
||||
|
||||
// noexcept assertions:
|
||||
// (functions that explicitly throw have their throws tested and therefore have no static_asserts)
|
||||
static_assert(noexcept(string_view{}), "default constructor not noexcept");
|
||||
|
|
Загрузка…
Ссылка в новой задаче