tmp/tmpspk_hpca/{from.md → to.md}
RENAMED
|
@@ -6,32 +6,29 @@ namespace std::ranges {
|
|
| 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_
|
| 32 |
-
Val
|
| 33 |
};
|
| 34 |
}
|
| 35 |
```
|
| 36 |
|
| 37 |
``` cpp
|
|
@@ -44,13 +41,5 @@ constexpr explicit basic_istream_view(basic_istream<CharT, Traits>& stream);
|
|
| 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 |
-
|
|
|
|
| 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 = char_traits<CharT>>
|
| 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 |
constexpr explicit basic_istream_view(basic_istream<CharT, Traits>& stream);
|
| 17 |
|
| 18 |
+
constexpr auto begin() {
|
| 19 |
+
*stream_ >> value_;
|
|
|
|
|
|
|
|
|
|
| 20 |
return iterator{*this};
|
| 21 |
}
|
| 22 |
|
| 23 |
constexpr default_sentinel_t end() const noexcept;
|
| 24 |
|
| 25 |
private:
|
| 26 |
+
// [range.istream.iterator], class basic_istream_view::iterator
|
| 27 |
struct iterator; // exposition only
|
| 28 |
+
basic_istream<CharT, Traits>* stream_; // exposition only
|
| 29 |
+
Val value_ = Val(); // exposition only
|
| 30 |
};
|
| 31 |
}
|
| 32 |
```
|
| 33 |
|
| 34 |
``` cpp
|
|
|
|
| 41 |
constexpr default_sentinel_t end() const noexcept;
|
| 42 |
```
|
| 43 |
|
| 44 |
*Effects:* Equivalent to: `return default_sentinel;`
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|