Horizon
Loading...
Searching...
No Matches
unbounded.hpp
1//
2// Copyright Eric Niebler 2014-present
3//
4// Use, modification and distribution is subject to the
5// Boost Software License, Version 1.0. (See accompanying
6// file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// Project home: https://github.com/ericniebler/range-v3
10//
11
12#ifndef RANGES_V3_VIEW_UNBOUNDED_HPP
13#define RANGES_V3_VIEW_UNBOUNDED_HPP
14
16
18#include <range/v3/utility/static_const.hpp>
20
21#include <range/v3/detail/prologue.hpp>
22
23namespace ranges
24{
27 template<typename I>
28 struct unbounded_view : view_interface<unbounded_view<I>, infinite>
29 {
30 private:
31 I it_;
32
33 public:
34 unbounded_view() = default;
35 constexpr explicit unbounded_view(I it)
36 : it_(detail::move(it))
37 {}
38 constexpr I begin() const
39 {
40 return it_;
41 }
42 constexpr unreachable_sentinel_t end() const
43 {
44 return {};
45 }
46 };
47
48 template<typename I>
49 RANGES_INLINE_VAR constexpr bool enable_borrowed_range<unbounded_view<I>> = true;
50
51 namespace views
52 {
54 {
55 template(typename I)(
56 requires input_iterator<I>)
57 constexpr unbounded_view<I> operator()(I it) const
58 {
59 return unbounded_view<I>{detail::move(it)};
60 }
61 };
62
65 RANGES_INLINE_VARIABLE(unbounded_fn, unbounded)
66 } // namespace views
68} // namespace ranges
69
70#include <range/v3/detail/epilogue.hpp>
71#include <range/v3/detail/satisfy_boost_range.hpp>
72RANGES_SATISFY_BOOST_RANGE(::ranges::unbounded_view)
73
74#endif
The input_iterator concept.
Definition unbounded.hpp:29
Definition unreachable_sentinel.hpp:27
Definition interface.hpp:129
Definition unbounded.hpp:54