tmp/tmptqv3e6g5/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class template `basic_istream_view` <a id="range.istream.view">[[range.istream.view]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::ranges {
|
| 5 |
+
template<class Val, class CharT, class Traits>
|
| 6 |
+
concept stream-extractable = // exposition only
|
| 7 |
+
requires(basic_istream<CharT, Traits>& is, Val& t) {
|
| 8 |
+
is >> t;
|
| 9 |
+
};
|
| 10 |
+
|
| 11 |
+
template<movable Val, class CharT, class Traits>
|
| 12 |
+
requires default_initializable<Val> &&
|
| 13 |
+
stream-extractable<Val, CharT, Traits>
|
| 14 |
+
class basic_istream_view : public view_interface<basic_istream_view<Val, CharT, Traits>> {
|
| 15 |
+
public:
|
| 16 |
+
basic_istream_view() = default;
|
| 17 |
+
constexpr explicit basic_istream_view(basic_istream<CharT, Traits>& stream);
|
| 18 |
+
|
| 19 |
+
constexpr auto begin()
|
| 20 |
+
{
|
| 21 |
+
if (stream_) {
|
| 22 |
+
*stream_ >> object_;
|
| 23 |
+
}
|
| 24 |
+
return iterator{*this};
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
constexpr default_sentinel_t end() const noexcept;
|
| 28 |
+
|
| 29 |
+
private:
|
| 30 |
+
struct iterator; // exposition only
|
| 31 |
+
basic_istream<CharT, Traits>* stream_ = nullptr; // exposition only
|
| 32 |
+
Val object_ = Val(); // exposition only
|
| 33 |
+
};
|
| 34 |
+
}
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
``` cpp
|
| 38 |
+
constexpr explicit basic_istream_view(basic_istream<CharT, Traits>& stream);
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
*Effects:* Initializes *stream\_* with `addressof(stream)`.
|
| 42 |
+
|
| 43 |
+
``` cpp
|
| 44 |
+
constexpr default_sentinel_t end() const noexcept;
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
*Effects:* Equivalent to: `return default_sentinel;`
|
| 48 |
+
|
| 49 |
+
``` cpp
|
| 50 |
+
template<class Val, class CharT, class Traits>
|
| 51 |
+
basic_istream_view<Val, CharT, Traits> istream_view(basic_istream<CharT, Traits>& s);
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
*Effects:* Equivalent to:
|
| 55 |
+
`return basic_istream_view<Val, CharT, Traits>{s};`
|
| 56 |
+
|