Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P2251R1 Update yvals_core.h and the comments in the tests #2259

Merged
merged 4 commits into from
Nov 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
// (the std::invoke function only; other components like bind and reference_wrapper are C++20 only)
// P1518R2 Stop Overconstraining Allocators In Container Deduction Guides
// P2162R2 Inheriting From variant
// P2251R1 Require span And basic_string_view To Be Trivially Copyable
// (basic_string_view always provides this behavior)

// _HAS_CXX17 indirectly controls:
// N4190 Removing auto_ptr, random_shuffle(), And Old <functional> Stuff
Expand Down Expand Up @@ -255,6 +257,8 @@
// P2116R0 Removing tuple-Like Protocol Support From Fixed-Extent span
// P2210R2 Superior String Splitting
// P2231R1 Completing constexpr In optional And variant
// P2251R1 Require span And basic_string_view To Be Trivially Copyable
// (span always provides this behavior)
// P2259R1 Repairing Input Range Adaptors And counted_iterator
// P2281R1 Clarifying Range Adaptor Objects
// P2325R3 Views Should Not Be Required To Be Default Constructible
Expand Down
15 changes: 7 additions & 8 deletions tests/std/tests/P0122R7_span/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,14 @@ static_assert(ranges::enable_borrowed_range<span<int>>);
static_assert(ranges::enable_borrowed_range<span<int, 3>>);
#endif // __cpp_lib_concepts

// We provide non-standard guarantees that span and its iterator types are trivially copyable;
// P2251 may eventually standardize that guarantee for span itself.
// N4901 [span.overview]/3
static_assert(is_trivially_copyable_v<span<int>>);
static_assert(is_trivially_copyable_v<span<int>::iterator>);
static_assert(is_trivially_copyable_v<span<int, 3>>);
static_assert(is_trivially_copyable_v<span<int, 3>::iterator>);
static_assert(is_trivially_copyable_v<span<const int>>);
static_assert(is_trivially_copyable_v<span<const int>::iterator>);
static_assert(is_trivially_copyable_v<span<const int, 3>>);
static_assert(is_trivially_copyable_v<span<const int, 3>::iterator>);

// For portability, our implementation provides an additional guarantee beyond the Standard
// that span and its iterators are standard-layout.
// Our implementation provides additional guarantees beyond the Standard
// that span and its iterators are standard-layout, and that the iterators are trivially copyable.
static_assert(is_standard_layout_v<span<int>>);
static_assert(is_standard_layout_v<span<int>::iterator>);
static_assert(is_standard_layout_v<span<int, 3>>);
Expand All @@ -100,6 +95,10 @@ static_assert(is_standard_layout_v<span<const int>>);
static_assert(is_standard_layout_v<span<const int>::iterator>);
static_assert(is_standard_layout_v<span<const int, 3>>);
static_assert(is_standard_layout_v<span<const int, 3>::iterator>);
static_assert(is_trivially_copyable_v<span<int>::iterator>);
static_assert(is_trivially_copyable_v<span<int, 3>::iterator>);
static_assert(is_trivially_copyable_v<span<const int>::iterator>);
static_assert(is_trivially_copyable_v<span<const int, 3>::iterator>);

// For performance, our implementation provides an additional guarantee beyond the Standard
// that fixed-size span has only the size of a pointer.
Expand Down
5 changes: 2 additions & 3 deletions tests/std/tests/P0220R1_string_view/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ const evil_conversion_to_string_view_lvalue_only convert_lvalue_only{};
#pragma clang diagnostic pop
#endif // __clang__

// We provide a non-standard guarantee that basic_string_view is trivially copyable;
// P2251 may eventually standardize that guarantee.
// N4901 [string.view.template.general]/4
static_assert(is_trivially_copyable_v<string_view>);
static_assert(is_trivially_copyable_v<wstring_view>);

// Similar non-standard guarantees
// Implied by N4901 [class.prop]/1
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>);
Expand Down