56 lines
2.2 KiB
Markdown
56 lines
2.2 KiB
Markdown
[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.2 Constructors"))[.](#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.2 Ranges [range.range]")[.](#3.sentence-1)
|
||
|
||
<ROS, std::span<charT>> && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept 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()))
|