-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++][sstream] P2495R3: Interfacing stringstream
s with string_view
#80552
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
[libc++][sstream] P2495R3: Interfacing stringstream
s with string_view
#80552
Conversation
stringstreams
with string_view
stringstream
s with string_view
✅ With the latest revision this PR passed the C/C++ code formatter. |
ac97d71
to
ca27c49
Compare
@llvm/pr-subscribers-libcxx Author: Hristo Hristov (H-G-Hristov) ChangesImplements P2495R3 <https://wg21.link/P2495R3>
References: Patch is 100.63 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/80552.diff 31 Files Affected:
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index a5c6fa22cec06..5a0bbf7df0b05 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -440,7 +440,7 @@ Status
--------------------------------------------------- -----------------
``__cpp_lib_span_initializer_list`` ``202311L``
--------------------------------------------------- -----------------
- ``__cpp_lib_sstream_from_string_view`` *unimplemented*
+ ``__cpp_lib_sstream_from_string_view`` ``202306L``
--------------------------------------------------- -----------------
``__cpp_lib_submdspan`` *unimplemented*
--------------------------------------------------- -----------------
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index db731de2e4399..f2ca6d073d2f1 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -40,6 +40,7 @@ Implemented Papers
- P2637R3 - Member ``visit``
- P2652R2 - Disallow User Specialization of ``allocator_traits``
+- P2495R3 - Interfacing ``stringstream``s with ``string_view``
Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv b/libcxx/docs/Status/Cxx2cPapers.csv
index a62faee4f44e2..dfc4208b5ccb5 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -6,7 +6,7 @@
"`P2545R4 <https://wg21.link/P2545R4>`__","LWG","Read-Copy Update (RCU)","Varna June 2023","","",""
"`P2530R3 <https://wg21.link/P2530R3>`__","LWG","Hazard Pointers for C++26","Varna June 2023","","",""
"`P2538R1 <https://wg21.link/P2538R1>`__","LWG","ADL-proof ``std::projected``","Varna June 2023","|Complete|","18.0","|ranges|"
-"`P2495R3 <https://wg21.link/P2495R3>`__","LWG","Interfacing ``stringstreams`` with ``string_view``","Varna June 2023","","",""
+"`P2495R3 <https://wg21.link/P2495R3>`__","LWG","Interfacing ``stringstream``s with ``string_view``","Varna June 2023","|Complete|","19.0",""
"`P2510R3 <https://wg21.link/P2510R3>`__","LWG","Formatting pointers","Varna June 2023","|Complete| [#note-P2510R3]_","17.0","|format|"
"`P2198R7 <https://wg21.link/P2198R7>`__","LWG","Freestanding Feature-Test Macros and Implementation-Defined Extensions","Varna June 2023","","",""
"`P2338R4 <https://wg21.link/P2338R4>`__","LWG","Freestanding Library: Character primitives and the C library","Varna June 2023","","",""
diff --git a/libcxx/include/sstream b/libcxx/include/sstream
index 6c354cf0b3973..f2be4c9bc8b1b 100644
--- a/libcxx/include/sstream
+++ b/libcxx/include/sstream
@@ -48,6 +48,13 @@ public:
template <class SAlloc>
explicit basic_stringbuf(const basic_string<char_type, traits_type, SAlloc>& s,
ios_base::openmode which = ios_base::in | ios_base::out); // C++20
+ template<class T>
+ explicit basic_stringbuf(const T& t,
+ ios_base::openmode which = ios_base::in | ios_base::out); // Since C++26
+ template<class T>
+ basic_stringbuf(const T& t, const Allocator& a); // Since C++26
+ template<class T>
+ basic_stringbuf(const T& t, ios_base::openmode which, const Allocator& a); // Since C++26
basic_stringbuf(basic_stringbuf&& rhs);
basic_stringbuf(basic_stringbuf&& rhs, const allocator_type& a); // C++20
@@ -67,6 +74,8 @@ public:
template <class SAlloc>
void str(const basic_string<char_type, traits_type, SAlloc>& s); // C++20
void str(basic_string<char_type, traits_type, allocator_type>&& s); // C++20
+ template<class T>
+ void str(const T& t); // Since C++26
protected:
// [stringbuf.virtuals] Overridden virtual functions:
@@ -119,6 +128,12 @@ public:
template <class SAlloc>
explicit basic_istringstream(const basic_string<char_type, traits_type, SAlloc>& s,
ios_base::openmode which = ios_base::in); // C++20
+ template<class T>
+ explicit basic_istringstream(const T& t, ios_base::openmode which = ios_base::in); // Since C++26
+ template<class T>
+ basic_istringstream(const T& t, const Allocator& a); // Since C++26
+ template<class T>
+ basic_istringstream(const T& t, ios_base::openmode which, const Allocator& a); // Since C++26
basic_istringstream(basic_istringstream&& rhs);
// [istringstream.assign] Assign and swap:
@@ -137,6 +152,8 @@ public:
template <class SAlloc>
void str(const basic_string<char_type, traits_type, SAlloc>& s); // C++20
void str(basic_string<char_type, traits_type, allocator_type>&& s); // C++20
+ template<class T>
+ void str(const T& t); // Since C++26
};
template <class charT, class traits, class Allocator>
@@ -178,6 +195,12 @@ public:
template <class SAlloc>
explicit basic_ostringstream(const basic_string<char_type, traits_type, SAlloc>& s,
ios_base::openmode which = ios_base::out); // C++20
+ template<class T>
+ explicit basic_ostringstream(const T& t, ios_base::openmode which = ios_base::out); // Since C++26
+ template<class T>
+ basic_ostringstream(const T& t, const Allocator& a); // Since C++26
+ template<class T>
+ basic_ostringstream(const T& t, ios_base::openmode which, const Allocator& a); // Since C++26
basic_ostringstream(basic_ostringstream&& rhs);
// [ostringstream.assign] Assign and swap:
@@ -196,6 +219,8 @@ public:
template <class SAlloc>
void str(const basic_string<char_type, traits_type, SAlloc>& s); // C++20
void str(basic_string<char_type, traits_type, allocator_type>&& s); // C++20
+ template<class T>
+ void str(const T& t); // Since C++26
};
template <class charT, class traits, class Allocator>
@@ -237,6 +262,13 @@ public:
template <class SAlloc>
explicit basic_stringstream(const basic_string<char_type, traits_type, SAlloc>& s,
ios_base::openmode which = ios_base::out | ios_base::in); // C++20
+ template<class T>
+ explicit basic_stringstream(const T& t,
+ ios_base::openmode which = ios_base::out | ios_base::in); // Since C++26
+ template<class T>
+ basic_stringstream(const T& t, const Allocator& a); // Since C++26
+ template<class T>
+ basic_stringstream(const T& t, ios_base::openmode which, const Allocator& a); // Since C++26
basic_stringstream(basic_stringstream&& rhs);
// [stringstream.assign] Assign and swap:
@@ -255,6 +287,8 @@ public:
template <class SAlloc>
void str(const basic_string<char_type, traits_type, SAlloc>& s); // C++20
void str(basic_string<char_type, traits_type, allocator_type>&& s); // C++20
+ template<class T>
+ void str(const T& t); // Since C++26
};
template <class charT, class traits, class Allocator>
@@ -274,10 +308,12 @@ typedef basic_stringstream<wchar_t> wstringstream;
#include <__availability>
#include <__config>
#include <__fwd/sstream.h>
+#include <__type_traits/is_convertible.h>
#include <__utility/swap.h>
#include <istream>
#include <ostream>
#include <string>
+#include <string_view>
#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -364,6 +400,30 @@ public:
}
#endif // _LIBCPP_STD_VER >= 20
+#if _LIBCPP_STD_VER >= 26
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const _Tp& __t,
+ ios_base::openmode __which = ios_base::in | ios_base::out)
+ : basic_stringbuf(__t, __which, _Allocator()) {}
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf(const _Tp& __t, const _Allocator& __a)
+ : basic_stringbuf(__t, ios_base::in | ios_base::out, __a) {}
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI basic_stringbuf(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a)
+ : __hm_(nullptr), __mode_(__which) {
+ basic_string_view<_CharT, _Traits> __sv = __t;
+ __str_ = string_type(__sv, __a);
+ __init_buf_ptrs();
+ }
+
+#endif // _LIBCPP_STD_VER >= 26
+
basic_stringbuf(basic_stringbuf&& __rhs) : __mode_(__rhs.__mode_) { __move_init(std::move(__rhs)); }
#if _LIBCPP_STD_VER >= 20
@@ -435,6 +495,18 @@ public:
}
#endif // _LIBCPP_STD_VER >= 20
+#if _LIBCPP_STD_VER >= 26
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) {
+ basic_string_view<_CharT, _Traits> __sv = __t;
+ __str_ = __sv;
+ __init_buf_ptrs();
+ }
+
+#endif // _LIBCPP_STD_VER >= 26
+
protected:
// [stringbuf.virtuals] Overridden virtual functions:
int_type underflow() override;
@@ -822,6 +894,25 @@ public:
: basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in) {}
#endif // _LIBCPP_STD_VER >= 20
+#if _LIBCPP_STD_VER >= 26
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(const _Tp& __t, ios_base::openmode __which = ios_base::in)
+ : basic_istringstream(__t, __which | ios_base::in, _Allocator()) {}
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream(const _Tp& __t, const _Allocator& __a)
+ : basic_istringstream(__t, ios_base::in, __a) {}
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a)
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__t, __which | ios_base::in, __a) {}
+
+#endif // _LIBCPP_STD_VER >= 26
+
_LIBCPP_HIDE_FROM_ABI basic_istringstream(basic_istringstream&& __rhs)
: basic_istream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
@@ -871,6 +962,14 @@ public:
_LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
#endif // _LIBCPP_STD_VER >= 20
+
+#if _LIBCPP_STD_VER >= 26
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) {
+ rdbuf()->str(__t);
+ }
+#endif // _LIBCPP_STD_VER >= 26
};
template <class _CharT, class _Traits, class _Allocator>
@@ -929,6 +1028,25 @@ public:
: basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out) {}
#endif // _LIBCPP_STD_VER >= 20
+#if _LIBCPP_STD_VER >= 26
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const _Tp& __t, ios_base::openmode __which = ios_base::out)
+ : basic_ostringstream(__t, __which | ios_base::out, _Allocator()) {}
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream(const _Tp& __t, const _Allocator& __a)
+ : basic_ostringstream(__t, ios_base::out, __a) {}
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI basic_ostringstream(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a)
+ : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__t, __which | ios_base::out, __a) {}
+
+#endif // _LIBCPP_STD_VER >= 26
+
_LIBCPP_HIDE_FROM_ABI basic_ostringstream(basic_ostringstream&& __rhs)
: basic_ostream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
@@ -979,6 +1097,14 @@ public:
_LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
#endif // _LIBCPP_STD_VER >= 20
+
+#if _LIBCPP_STD_VER >= 26
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) {
+ rdbuf()->str(__t);
+ }
+#endif // _LIBCPP_STD_VER >= 26
};
template <class _CharT, class _Traits, class _Allocator>
@@ -1040,6 +1166,26 @@ public:
: basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch) {}
#endif // _LIBCPP_STD_VER >= 20
+#if _LIBCPP_STD_VER >= 26
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(const _Tp& __t,
+ ios_base::openmode __which = ios_base::out | ios_base::in)
+ : basic_stringstream(__t, __which, _Allocator()) {}
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI basic_stringstream(const _Tp& __t, const _Allocator& __a)
+ : basic_stringstream(__t, ios_base::out | ios_base::in, __a) {}
+
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI basic_stringstream(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a)
+ : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__t, __which, __a) {}
+
+#endif // _LIBCPP_STD_VER >= 26
+
_LIBCPP_HIDE_FROM_ABI basic_stringstream(basic_stringstream&& __rhs)
: basic_iostream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) {
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
@@ -1089,6 +1235,14 @@ public:
_LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); }
#endif // _LIBCPP_STD_VER >= 20
+
+#if _LIBCPP_STD_VER >= 26
+ template <class _Tp>
+ requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
+ _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) {
+ rdbuf()->str(__t);
+ }
+#endif // _LIBCPP_STD_VER >= 26
};
template <class _CharT, class _Traits, class _Allocator>
diff --git a/libcxx/include/version b/libcxx/include/version
index e4dbb7bdd5fc2..4fbba978b6b0e 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -508,7 +508,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
// # define __cpp_lib_smart_ptr_owner_equality 202306L
# define __cpp_lib_span_at 202311L
# define __cpp_lib_span_initializer_list 202311L
-// # define __cpp_lib_sstream_from_string_view 202306L
+# define __cpp_lib_sstream_from_string_view 202306L
// # define __cpp_lib_submdspan 202306L
// # define __cpp_lib_text_encoding 202306L
# undef __cpp_lib_to_chars
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index d4c22023db7a0..08b2a7431c815 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -742,6 +742,7 @@ sstream cstddef
sstream istream
sstream ostream
sstream string
+sstream string_view
sstream type_traits
sstream version
stack compare
@@ -833,13 +834,17 @@ system_error type_traits
system_error version
thread array
thread atomic
+thread cctype
thread cerrno
thread chrono
+thread clocale
thread compare
thread cstddef
thread cstdint
+thread cstdlib
thread cstring
thread ctime
+thread cwchar
thread functional
thread iosfwd
thread limits
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index 5eb839a3aa7a6..2039c60e79f03 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -748,6 +748,7 @@ sstream cstddef
sstream istream
sstream ostream
sstream string
+sstream string_view
sstream type_traits
sstream version
stack compare
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index 7b372fb37dcd5..3d3eb2822722c 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -750,6 +750,7 @@ sstream cstddef
sstream istream
sstream ostream
sstream string
+sstream string_view
sstream type_traits
sstream version
stack compare
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index 7b372fb37dcd5..3d3eb2822722c 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -750,6 +750,7 @@ sstream cstddef
sstream istream
sstream ostream
sstream string
+sstream string_view
sstream type_traits
sstream version
stack compare
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 9b4915a468d1c..557b08915ddeb 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -755,6 +755,7 @@ sstream cstddef
sstream istream
sstream ostream
sstream string
+sstream string_view
sstream type_traits
sstream version
stack compare
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 7c7099d176f18..61b063b08b0b2 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -519,6 +519,7 @@ sstream cstddef
sstream istream
sstream ostream
sstream string
+sstream string_view
sstream version
stack compare
stack cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index 7c7099d176f18..61b063b08b0b2 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -519,6 +519,7 @@ sstream cstddef
sstream istream
sstream ostream
sstream string
+sstream string_view
sstream version
stack compare
stack cstddef
diff --git a/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/string_view.alloc.pass.cpp b/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/string_view.alloc.pass.cpp
new file mode 100644
index 0000000000000..92ec33f6a0d61
--- /dev/null
+++ b/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/string_view.alloc.pass.cpp
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
+// class basic_stringstream
+
+// template<class T>
+// basic_istringstream(const T& t, const Allocator& a);
+
+#include <cassert>
+#include <concepts>
+#include <sstream>
+#include <string>
+#include <string_view>
+
+#include "make_string.h"
+#include "test_allocator.h"
+#include "test_convertible.h"
+#include "test_macros.h"
+
+template <typename CharT>
+void test_sfinae() {
+ struct SomeObject {};
+ struct NonAllocator...
[truncated]
|
…iew` Implements P2495R3 <https://wg21.link/P2495R3> - https://eel.is/c++draft/version.syn#headerref:%3csstream%3e - https://eel.is/c++draft/stringbuf - https://eel.is/c++draft/stringbuf.general - https://eel.is/c++draft/stringbuf.cons - https://eel.is/c++draft/stringbuf.members - https://eel.is/c++draft/istringstream - https://eel.is/c++draft/istringstream.general - https://eel.is/c++draft/istringstream.cons - https://eel.is/c++draft/istringstream.members - https://eel.is/c++draft/ostringstream - https://eel.is/c++draft/ostringstream.general - https://eel.is/c++draft/ostringstream.cons - https://eel.is/c++draft/ostringstream.members - https://eel.is/c++draft/stringstream - https://eel.is/c++draft/stringstream.general - https://eel.is/c++draft/stringstream.cons - https://eel.is/c++draft/stringstream.members References: - https://eel.is/c++draft/string.streams
ca27c49
to
879bc43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. The code side looks very good, I like to improve the tests a bit further. I have not reviewed all tests in detail. Maybe first focus on the istringstream tests, when these are done they can be copy-pasted to the othter tests.
.../std/input.output/string.streams/istringstream/istringstream.cons/string_view.alloc.pass.cpp
Show resolved
Hide resolved
.../std/input.output/string.streams/istringstream/istringstream.cons/string_view.alloc.pass.cpp
Show resolved
Hide resolved
...input.output/string.streams/istringstream/istringstream.cons/string_view.mode.alloc.pass.cpp
Outdated
Show resolved
Hide resolved
...std/input.output/string.streams/istringstream/istringstream.members/str.string_view.pass.cpp
Outdated
Show resolved
Hide resolved
...std/input.output/string.streams/istringstream/istringstream.members/str.string_view.pass.cpp
Outdated
Show resolved
Hide resolved
…s-with-string_view
…s-with-string_view
…tringstream.cons/string_view.mode.alloc.pass.cpp
…s-with-string_view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor points for the tests. This starts to look nicely. Happy to see tests that validate conversion with different traits and allocators.
...input.output/string.streams/istringstream/istringstream.cons/string_view.mode.alloc.pass.cpp
Outdated
Show resolved
Hide resolved
.../std/input.output/string.streams/istringstream/istringstream.cons/string_view.alloc.pass.cpp
Outdated
Show resolved
Hide resolved
.../std/input.output/string.streams/istringstream/istringstream.cons/string_view.alloc.pass.cpp
Outdated
Show resolved
Hide resolved
.../std/input.output/string.streams/istringstream/istringstream.cons/string_view.alloc.pass.cpp
Outdated
Show resolved
Hide resolved
…s-with-string_view
…s-with-string_view
@mordante I "templatized" the test functions to addressed your comments, which also reduced the line count. I updated all tests but |
…s-with-string_view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly LGTM. I'd like to have better names for the new helper headers and would like to have a short look at that before approving.
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef TEST_STD_INPUTOUTPUT_STRINGSTREAMS_TYPES_H | ||
#define TEST_STD_INPUTOUTPUT_STRINGSTREAMS_TYPES_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please improve the naming of this file too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This filename is quite common in other tests, e.g. "ranges". I'd rather keep it for consistency. I did rename it as requested. Do you have anything specific in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't noticed this before. I feel types.h
is really a generic name; my system has about 300 of them. I see you renamed it to helper_types.h
, which is less generic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the review!
Implements P2495R3 https://wg21.link/P2495R3
References: