Skip to content

Commit c8589b6

Browse files
committed
Adressed some review comments
1 parent ea35161 commit c8589b6

File tree

7 files changed

+29
-43
lines changed

7 files changed

+29
-43
lines changed

libcxx/include/__fwd/spanstream.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
# pragma GCC system_header
1717
#endif
1818

19-
_LIBCPP_BEGIN_NAMESPACE_STD
20-
2119
#if _LIBCPP_STD_VER >= 23
2220

21+
_LIBCPP_BEGIN_NAMESPACE_STD
22+
2323
template <class _CharT, class _Traits = char_traits<_CharT>>
2424
class basic_spanbuf;
2525
template <class _CharT, class _Traits = char_traits<_CharT>>
@@ -41,8 +41,20 @@ using wospanstream = basic_ospanstream<wchar_t>;
4141
using wspanstream = basic_spanstream<wchar_t>;
4242
# endif
4343

44-
#endif // _LIBCPP_STD_VER >= 23
44+
template <class _CharT, class _Traits>
45+
class _LIBCPP_PREFERRED_NAME(spanbuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wspanbuf)) basic_spanbuf;
46+
template <class _CharT, class _Traits>
47+
class _LIBCPP_PREFERRED_NAME(ispanstream)
48+
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wispanstream)) basic_ispanstream;
49+
template <class _CharT, class _Traits>
50+
class _LIBCPP_PREFERRED_NAME(ospanstream)
51+
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wospanstream)) basic_ospanstream;
52+
template <class _CharT, class _Traits>
53+
class _LIBCPP_PREFERRED_NAME(spanstream)
54+
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wspanstream)) basic_spanstream;
4555

4656
_LIBCPP_END_NAMESPACE_STD
4757

58+
#endif // _LIBCPP_STD_VER >= 23
59+
4860
#endif // _LIBCPP___FWD_SPANSTREAM_H

libcxx/include/spanstream

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
# include <__utility/move.h>
7272
# include <__utility/swap.h>
7373
# include <ios>
74-
# include <iostream>
74+
# include <istream>
75+
# include <ostream>
7576
# include <span>
7677
# include <streambuf>
7778
# include <version>
@@ -83,10 +84,10 @@
8384
_LIBCPP_PUSH_MACROS
8485
# include <__undef_macros>
8586

86-
_LIBCPP_BEGIN_NAMESPACE_STD
87-
8887
# if _LIBCPP_STD_VER >= 23
8988

89+
_LIBCPP_BEGIN_NAMESPACE_STD
90+
9091
// Class template basic_spanbuf [spanbuf]
9192

9293
template <class _CharT, class _Traits>
@@ -453,10 +454,10 @@ using std::spanstream;
453454
using std::wspanstream;
454455
# endif
455456

456-
# endif // _LIBCPP_STD_VER >= 23
457-
458457
_LIBCPP_END_NAMESPACE_STD
459458

459+
# endif // _LIBCPP_STD_VER >= 23
460+
460461
_LIBCPP_POP_MACROS
461462

462463
# endif // _LIBCPP_HAS_LOCALIZATION

libcxx/test/std/input.output/iostream.forward/iosfwd.pass.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,19 @@ int main(int, char**)
7575
#endif
7676

7777
#if TEST_STD_VER >= 23
78-
test<std::basic_spanbuf<unsigned short>*>();
7978
test<std::basic_spanbuf<char>*>();
8079
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
8180
test<std::basic_spanbuf<wchar_t>*>();
8281
# endif
83-
test<std::basic_ispanstream<unsigned short>*>();
8482
test<std::basic_ispanstream<char>*>();
8583
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
8684
test<std::basic_ispanstream<wchar_t>*>();
8785
# endif
88-
test<std::basic_ospanstream<unsigned short>*>();
8986
test<std::basic_ospanstream<char>*>();
9087
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
9188
test<std::basic_ospanstream<wchar_t>*>();
9289
# endif
9390
test<std::basic_spanstream<char>*>();
94-
test<std::basic_spanstream<unsigned short>*>();
9591
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
9692
test<std::basic_spanstream<wchar_t>*>();
9793
# endif

libcxx/test/std/input.output/span.streams/helper_functions.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

libcxx/test/std/input.output/span.streams/ispanstream/inherited.stream.ops.pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
// Test stream operations inherited from `basic_istream`
1818

19+
#include <algorithm>
1920
#include <cassert>
2021
#include <span>
2122
#include <spanstream>
@@ -24,7 +25,6 @@
2425
#include "constexpr_char_traits.h"
2526
#include "test_macros.h"
2627

27-
#include "../helper_functions.h"
2828
#include "../helper_macros.h"
2929
#include "../helper_types.h"
3030

@@ -80,7 +80,7 @@ void test() {
8080
{
8181
// Create a std::span test value
8282
CharT arr[30UZ]{};
83-
initialize_array_from_string_view(arr, sv);
83+
std::ranges::copy(sv, arr);
8484

8585
std::span<CharT> sp{arr};
8686

@@ -99,7 +99,7 @@ void test() {
9999
{
100100
// Create a "Read Only Sequence" test value
101101
CharT arr[30UZ]{};
102-
initialize_array_from_string_view(arr, sv);
102+
std::ranges::copy(sv, arr);
103103

104104
ReadOnlySpan<CharT, 30UZ> ros{arr};
105105
assert(ros.size() == 30UZ);

libcxx/test/std/input.output/span.streams/ospanstream/inherited.stream.ops.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
// Test stream operations inherited from `basic_ostream`
1818

19+
#include <algorithm>
1920
#include <cassert>
2021
#include <span>
2122
#include <spanstream>
@@ -25,7 +26,6 @@
2526
#include "constexpr_char_traits.h"
2627
#include "test_macros.h"
2728

28-
#include "../helper_functions.h"
2929
#include "../helper_macros.h"
3030
#include "../helper_types.h"
3131

@@ -45,7 +45,7 @@ void test() {
4545

4646
// Create a std::span test value
4747
CharT arr[arrSize]{};
48-
initialize_array_from_string_view(arr, sv);
48+
std::ranges::copy(sv, arr);
4949
std::span<CharT> sp{arr};
5050

5151
// `std::span` + Mode: default (`out`)

libcxx/test/std/input.output/span.streams/spanbuf/spanbuf.cons/default.pass.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ template <typename CharT, typename TraitsT = std::char_traits<CharT>>
2828
void test() {
2929
using SpBuf = std::basic_spanbuf<CharT, TraitsT>;
3030

31-
{
32-
SpBuf spBuf;
33-
assert(spBuf.span().data() == nullptr);
34-
assert(spBuf.span().size() == 0);
35-
}
31+
SpBuf spBuf;
32+
assert(spBuf.span().data() == nullptr);
33+
assert(spBuf.span().size() == 0);
3634
}
3735

3836
int main(int, char**) {

0 commit comments

Comments
 (0)