Horizon
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 
15 #include <range/v3/range_fwd.hpp>
16 
18 #include <range/v3/utility/static_const.hpp>
20 
21 #include <range/v3/detail/prologue.hpp>
22 
23 namespace 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  {
53  struct unbounded_fn
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 
66  } // namespace views
68 } // namespace ranges
69 
70 #include <range/v3/detail/epilogue.hpp>
71 #include <range/v3/detail/satisfy_boost_range.hpp>
72 RANGES_SATISFY_BOOST_RANGE(::ranges::unbounded_view)
73 
74 #endif
RANGES_INLINE_VARIABLE(detail::to_container_fn< detail::from_range< std::vector >>, to_vector) template< template< typename... > class ContT > auto to(RANGES_HIDDEN_DETAIL(detail
For initializing a container of the specified type with the elements of an Range.
Definition: conversion.hpp:399
Definition: unbounded.hpp:29
Definition: unreachable_sentinel.hpp:27
Definition: interface.hpp:129
Definition: unbounded.hpp:54