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

Implement P0448R4 spanstream #2029

Merged
merged 35 commits into from
Sep 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e94ce25
Implement spanstream
miscco Jun 26, 2021
3d12c64
Move aliases into iosfwd
miscco Jun 30, 2021
e9dee40
Address review comments
miscco Jul 1, 2021
40edba9
Add iosfwd test in sync with C++23
miscco Jul 1, 2021
e59ac94
Address review comments
miscco Jul 1, 2021
95643a5
More review comments
miscco Jul 1, 2021
5b413fb
Merge branch 'main' into spanstream
miscco Jul 23, 2021
ff35037
Address review comments
miscco Jul 23, 2021
1537a09
Merge branch 'main' into spanstream
miscco Aug 4, 2021
ef50108
uNstreampos is defined in xstring
miscco Aug 4, 2021
822de91
Merge branch 'main' into spanstream
miscco Aug 6, 2021
3ed6a02
Address review comments
miscco Aug 6, 2021
c61afd8
Add tests for const buffer
miscco Aug 6, 2021
2587e4c
Merge branch 'main' into spanstream
StephanTLavavej Aug 24, 2021
b1650ea
Work around DevCom-1511903.
StephanTLavavej Aug 24, 2021
92ec9c3
Merge branch 'main' into spanstream
StephanTLavavej Aug 28, 2021
76c7c7b
Add comment about `_STD span`.
StephanTLavavej Aug 28, 2021
e7b10b2
Private typedefs.
StephanTLavavej Aug 28, 2021
d03004d
Call member swap().
StephanTLavavej Aug 28, 2021
8b309e3
Mark rdbuf() and span() as _NODISCARD.
StephanTLavavej Aug 28, 2021
d57fc0a
Always qualify _STD span.
StephanTLavavej Aug 28, 2021
d0ec9af
Assignment needs to `return *this;`.
StephanTLavavej Aug 28, 2021
a2a4923
Comment nitpick: "member functions".
StephanTLavavej Aug 28, 2021
3134d3f
Drop `this->` for `rdbuf()`.
StephanTLavavej Aug 28, 2021
862f03d
`basic_ospanstream` and `basic_spanstream` need to return `span<_Elem>`.
StephanTLavavej Aug 28, 2021
8cad51f
Include more headers in the test.
StephanTLavavej Aug 28, 2021
31bca31
Fix comment typo.
StephanTLavavej Aug 28, 2021
5257648
Avoid test_buf shadowing.
StephanTLavavej Aug 28, 2021
1b5d100
Rename basic_ospanstream to os.
StephanTLavavej Aug 28, 2021
5116294
`test_spanstream()` should use `basic_spanstream` named `s`.
StephanTLavavej Aug 28, 2021
205178e
Fix test: `basic_spanstream` can't be constructed from `span<const Ch…
StephanTLavavej Aug 28, 2021
d40f1ee
Comment: `_Baseoff` is always non-negative.
StephanTLavavej Aug 28, 2021
34e426c
Add test that the returned `span` is indeed mutable
miscco Aug 28, 2021
7130829
Delete the (unintentionally re-added) vcpkg submodule.
StephanTLavavej Aug 30, 2021
f57ff9f
Use variable templates in the test.
StephanTLavavej Sep 8, 2021
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
12 changes: 12 additions & 0 deletions tests/std/tests/P0448R4_spanstream/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,10 @@ void test_ispanstream() {
assert(is.span().data() == buffer);
assert(is.span().size() == size(buffer));

StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
// ensure the underlying span is *not* mutable
static_assert(is_same_v<decltype(is.span()), span<const CharT>>);
static_assert(is_same_v<decltype(as_const(is).span()), span<const CharT>>);

CharT other_buffer[20];
is.span(span<CharT>{other_buffer});
assert(is.span().data() == other_buffer);
Expand Down Expand Up @@ -774,6 +778,10 @@ void test_ospanstream() {
assert(os.span().data() == buffer);
assert(os.span().size() == 0);

// ensure the underlying span is mutable
static_assert(is_same_v<decltype(os.span()), span<CharT>>);
static_assert(is_same_v<decltype(as_const(os).span()), span<CharT>>);

CharT other_buffer[20];
os.span(span<CharT>{other_buffer});
assert(os.span().data() == other_buffer);
Expand Down Expand Up @@ -906,6 +914,10 @@ void test_spanstream() {
assert(s.span().data() == buffer);
assert(s.span().size() == 0);

// ensure the underlying span is mutable
static_assert(is_same_v<decltype(s.span()), span<CharT>>);
static_assert(is_same_v<decltype(as_const(s).span()), span<CharT>>);

CharT other_buffer[20];
s.span(span<CharT>{other_buffer});
assert(s.span().data() == other_buffer);
Expand Down
1 change: 1 addition & 0 deletions vcpkg
Submodule vcpkg added at 125735