File indexing completed on 2025-01-18 10:09:59
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef RANGES_V3_VIEW_UNBOUNDED_HPP
0013 #define RANGES_V3_VIEW_UNBOUNDED_HPP
0014
0015 #include <range/v3/range_fwd.hpp>
0016
0017 #include <range/v3/iterator/unreachable_sentinel.hpp>
0018 #include <range/v3/utility/static_const.hpp>
0019 #include <range/v3/view/interface.hpp>
0020
0021 #include <range/v3/detail/prologue.hpp>
0022
0023 namespace ranges
0024 {
0025
0026
0027 template<typename I>
0028 struct unbounded_view : view_interface<unbounded_view<I>, infinite>
0029 {
0030 private:
0031 I it_;
0032
0033 public:
0034 unbounded_view() = default;
0035 constexpr explicit unbounded_view(I it)
0036 : it_(detail::move(it))
0037 {}
0038 constexpr I begin() const
0039 {
0040 return it_;
0041 }
0042 constexpr unreachable_sentinel_t end() const
0043 {
0044 return {};
0045 }
0046 };
0047
0048 template<typename I>
0049 RANGES_INLINE_VAR constexpr bool enable_borrowed_range<unbounded_view<I>> = true;
0050
0051 namespace views
0052 {
0053 struct unbounded_fn
0054 {
0055 template(typename I)(
0056 requires input_iterator<I>)
0057 constexpr unbounded_view<I> operator()(I it) const
0058 {
0059 return unbounded_view<I>{detail::move(it)};
0060 }
0061 };
0062
0063
0064
0065 RANGES_INLINE_VARIABLE(unbounded_fn, unbounded)
0066 }
0067
0068 }
0069
0070 #include <range/v3/detail/epilogue.hpp>
0071 #include <range/v3/detail/satisfy_boost_range.hpp>
0072 RANGES_SATISFY_BOOST_RANGE(::ranges::unbounded_view)
0073
0074 #endif