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

56 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[ispanstream.cons]
# 31 Input/output library [[input.output]](./#input.output)
## 31.9 Span-based streams [[span.streams]](span.streams#ispanstream.cons)
### 31.9.4 Class template basic_ispanstream [[ispanstream]](ispanstream#cons)
#### 31.9.4.2 Constructors [ispanstream.cons]
[🔗](#lib:basic_ispanstream,constructor)
`explicit basic_ispanstream(std::span<charT> s, ios_base::openmode which = ios_base::in);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L10455)
*Effects*: Initializes the base class withbasic_istream<charT, traits>(addressof(*sb*)) and *sb* withbasic_spanbuf<charT, traits>(s, which | ios_base::in) ([[spanbuf.cons]](spanbuf.cons "31.9.3.2Constructors"))[.](#1.sentence-1)
[🔗](#lib:basic_ispanstream,constructor_)
`basic_ispanstream(basic_ispanstream&& rhs);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L10469)
*Effects*: Initializes the base class with std::move(rhs) and *sb* with std::move(rhs.*sb*)[.](#2.sentence-1)
Next, basic_istream<charT, traits>::set_rdbuf(addressof(*sb*)) is called
to install the contained basic_spanbuf[.](#2.sentence-2)
[🔗](#lib:basic_ispanstream,constructor__)
`template<class ROS> explicit basic_ispanstream(ROS&& s)
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L10483)
*Constraints*: ROS models ranges::[borrowed_range](range.range#concept:borrowed_range "25.4.2Ranges[range.range]")[.](#3.sentence-1)
![convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<ROS, std::span<charT>> && [convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<ROS, std::span<charT const>> is true[.](#3.sentence-2)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L10489)
*Effects*: Let sp be std::span<const charT>(std::forward<ROS>(s))[.](#4.sentence-1)
Equivalent to:basic_ispanstream(std::span<charT>(const_cast<charT*>(sp.data()), sp.size()))