| 1 | // { dg-options "-D_GLIBCXX_CONCEPT_CHECKS" } |
| 2 | // { dg-do run { target c++11 } } |
| 3 | |
| 4 | #include <iterator> |
| 5 | #include <utility> |
| 6 | #include <sstream> |
| 7 | #include <string> |
| 8 | #include <testsuite_hooks.h> |
| 9 | |
| 10 | template<typename Distance, typename InputRange> |
| 11 | std::pair<std::istream_iterator<char>, std::istream_iterator<char>> |
| 12 | drop(Distance n, InputRange& rng) |
| 13 | { |
| 14 | return std::make_pair(std::next(std::istream_iterator<char>(rng), n), |
| 15 | std::istream_iterator<char>() |
| 16 | ); |
| 17 | } |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | std::stringstream x("let let there be rock"); |
| 22 | x << std::noskipws; |
| 23 | auto y = drop(4, x); |
| 24 | std::string z(y.first, y.second); |
| 25 | VERIFY(z == "let there be rock"); |
| 26 | } |