@@ -100,12 +100,23 @@ public:
100
100
typedef Allocator allocator_type;
101
101
102
102
// [istringstream.cons] Constructors:
103
- explicit basic_istringstream(ios_base::openmode which = ios_base::in); // before C++20
104
- basic_istringstream() : basic_istringstream(ios_base::in) {} // C++20
105
- explicit basic_istringstream(ios_base::openmode which); // C++20
106
-
107
- explicit basic_istringstream(const basic_string<char_type, traits_type,allocator_type>& str,
103
+ explicit basic_istringstream(ios_base::openmode which = ios_base::in); // before C++20
104
+ basic_istringstream() : basic_istringstream(ios_base::in) {} // C++20
105
+ explicit basic_istringstream(ios_base::openmode which); // C++20
106
+ explicit basic_istringstream(const basic_string<char_type, traits_type, allocator_type>& s,
108
107
ios_base::openmode which = ios_base::in);
108
+ basic_istringstream(ios_base::openmode which, const allocator_type& a); // C++20
109
+ explicit basic_istringstream(basic_string<char_type, traits_type, allocator_type>&& s,
110
+ ios_base::openmode which = ios_base::in); // C++20
111
+ template <class SAlloc>
112
+ basic_istringstream(const basic_string<char_type, traits_type, SAlloc>& s, const allocator_type& a)
113
+ : basic_istringstream(s, ios_base::in, a) {} // C++20
114
+ template <class SAlloc>
115
+ basic_istringstream(const basic_string<char_type, traits_type, SAlloc>& s,
116
+ ios_base::openmode which, const allocator_type& a); // C++20
117
+ template <class SAlloc>
118
+ explicit basic_istringstream(const basic_string<char_type, traits_type, SAlloc>& s,
119
+ ios_base::openmode which = ios_base::in); // C++20
109
120
basic_istringstream(basic_istringstream&& rhs);
110
121
111
122
// [istringstream.assign] Assign and swap:
@@ -114,9 +125,16 @@ public:
114
125
115
126
// [istringstream.members] Member functions:
116
127
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
117
- basic_string<char_type, traits_type, allocator_type> str() const;
128
+ basic_string<char_type, traits_type, allocator_type> str() const; // before C++20
129
+ basic_string<char_type, traits_type, allocator_type> str() const &; // C++20
130
+ template <class SAlloc>
131
+ basic_string<char_type, traits_type, SAlloc> str(const SAlloc& sa) const; // C++20
132
+ basic_string<char_type, traits_type, allocator_type> str() &&; // C++20
133
+ basic_string_view<char_type, traits_type> view() const noexcept; // C++20
118
134
void str(const basic_string<char_type, traits_type, allocator_type>& s);
119
- basic_string_view<char_type, traits_type> view() const noexcept; // C++20
135
+ template <class SAlloc>
136
+ void str(const basic_string<char_type, traits_type, SAlloc>& s); // C++20
137
+ void str(basic_string<char_type, traits_type, allocator_type>&& s); // C++20
120
138
};
121
139
122
140
template <class charT, class traits, class Allocator>
@@ -790,6 +808,28 @@ public:
790
808
, __sb_(__s, __wch | ios_base::in)
791
809
{ }
792
810
811
+ #if _LIBCPP_STD_VER >= 20
812
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream (ios_base::openmode __wch, const _Allocator& __a)
813
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::in, __a) {}
814
+
815
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream (string_type&& __s, ios_base::openmode __wch = ios_base::in)
816
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__s), __wch | ios_base::in) {}
817
+
818
+ template <class _SAlloc >
819
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream (const basic_string<_CharT, _Traits, _SAlloc>& __s, const _Allocator& __a)
820
+ : basic_istringstream(__s, ios_base::in, __a) {}
821
+
822
+ template <class _SAlloc >
823
+ _LIBCPP_HIDE_FROM_ABI basic_istringstream (
824
+ const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch, const _Allocator& __a)
825
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in, __a) {}
826
+
827
+ template <class _SAlloc >
828
+ _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream (const basic_string<_CharT, _Traits, _SAlloc>& __s,
829
+ ios_base::openmode __wch = ios_base::in)
830
+ : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in) {}
831
+ #endif // _LIBCPP_STD_VER >= 20
832
+
793
833
_LIBCPP_INLINE_VISIBILITY
794
834
basic_istringstream (basic_istringstream&& __rhs)
795
835
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
@@ -815,20 +855,33 @@ public:
815
855
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf () const {
816
856
return const_cast <basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
817
857
}
818
- _LIBCPP_INLINE_VISIBILITY
819
- string_type str () const {
820
- return __sb_.str ();
821
- }
822
- _LIBCPP_INLINE_VISIBILITY
823
- void str (const string_type& __s) {
824
- __sb_.str (__s);
858
+
859
+ #if _LIBCPP_STD_VER >= 20
860
+ _LIBCPP_HIDE_FROM_ABI string_type str () const & { return __sb_.str (); }
861
+
862
+ template <class _SAlloc >
863
+ requires __is_allocator<_SAlloc>::value
864
+ _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str (const _SAlloc& __sa) const {
865
+ return __sb_.str (__sa);
825
866
}
867
+
868
+ _LIBCPP_HIDE_FROM_ABI string_type str () && { return std::move (__sb_).str (); }
869
+
870
+ _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view () const noexcept { return __sb_.view (); }
871
+ #else // _LIBCPP_STD_VER >= 20
872
+ _LIBCPP_HIDE_FROM_ABI string_type str () const { return __sb_.str (); }
873
+ #endif // _LIBCPP_STD_VER >= 20
874
+
875
+ _LIBCPP_HIDE_FROM_ABI void str (const string_type& __s) { __sb_.str (__s); }
876
+
826
877
#if _LIBCPP_STD_VER >= 20
827
- _LIBCPP_HIDE_FROM_ABI
828
- basic_string_view <char_type, traits_type> view () const noexcept {
829
- return __sb_.view ( );
878
+ template < class _SAlloc >
879
+ _LIBCPP_HIDE_FROM_ABI void str ( const basic_string <char_type, traits_type, _SAlloc>& __s) {
880
+ __sb_.str (__s );
830
881
}
831
- #endif
882
+
883
+ _LIBCPP_HIDE_FROM_ABI void str (string_type&& __s) { __sb_.str (std::move (__s)); }
884
+ #endif // _LIBCPP_STD_VER >= 20
832
885
};
833
886
834
887
template <class _CharT , class _Traits , class _Allocator >
0 commit comments