Files
2025-10-25 03:02:53 +03:00

3.4 KiB
Raw Permalink Blame History

[istringstream.general]

31 Input/output library [input.output]

31.8 String-based streams [string.streams]

31.8.3 Class template basic_istringstream [istringstream]

31.8.3.1 General [istringstream.general]

🔗

namespace std {template<class charT, class traits = char_traits, class Allocator = allocator>class basic_istringstream : public basic_istream<charT, traits> {public:using char_type = charT; using int_type = typename traits::int_type; using pos_type = typename traits::pos_type; using off_type = typename traits::off_type; using traits_type = traits; using allocator_type = Allocator; // [istringstream.cons], constructors basic_istringstream() : basic_istringstream(ios_base::in) {}explicit basic_istringstream(ios_base::openmode which); explicit basic_istringstream(const basic_string<charT, traits, Allocator>& s, ios_base::openmode which = ios_base::in); basic_istringstream(ios_base::openmode which, const Allocator& a); explicit basic_istringstream( basic_string<charT, traits, Allocator>&& s, ios_base::openmode which = ios_base::in); template basic_istringstream(const basic_string<charT, traits, SAlloc>& s, const Allocator& a): basic_istringstream(s, ios_base::in, a) {}template basic_istringstream(const basic_string<charT, traits, SAlloc>& s, ios_base::openmode which, const Allocator& a); templateexplicit basic_istringstream(const basic_string<charT, traits, SAlloc>& s, ios_base::openmode which = ios_base::in); templateexplicit basic_istringstream(const T& t, ios_base::openmode which = ios_base::in); template basic_istringstream(const T& t, const Allocator& a); template basic_istringstream(const T& t, ios_base::openmode which, const Allocator& a); basic_istringstream(const basic_istringstream&) = delete; basic_istringstream(basic_istringstream&& rhs);

basic_istringstream& operator=(const basic_istringstream&) = delete; basic_istringstream& operator=(basic_istringstream&& rhs); // [istringstream.swap], swapvoid swap(basic_istringstream& rhs); // [istringstream.members], members basic_stringbuf<charT, traits, Allocator>* rdbuf() const; basic_string<charT, traits, Allocator> str() const &; template basic_string<charT,traits,SAlloc> str(const SAlloc& sa) const; basic_string<charT, traits, Allocator> str() &&; basic_string_view<charT, traits> view() const noexcept; void str(const basic_string<charT, traits, Allocator>& s); templatevoid str(const basic_string<charT, traits, SAlloc>& s); void str(basic_string<charT, traits, Allocator>&& s); templatevoid str(const T& t); private: basic_stringbuf<charT, traits, Allocator> sb; // exposition only};}

1

#

The classbasic_istringstream<charT, traits, Allocator> supports reading objects of classbasic_string<charT, traits, Allocator>.

It uses abasic_stringbuf<charT, traits, Allocator> object to control the associated storage.

For the sake of exposition, the maintained data is presented here as:

sb, the stringbuf object.