VCCC  2024.05
VisualCamp Common C++ library
next.hpp
Go to the documentation of this file.
1 //
2 // Created by cosge on 2024-01-13.
3 //
4 
5 #ifndef VCCC_ITERATOR_NEXT_HPP_
6 #define VCCC_ITERATOR_NEXT_HPP_
7 
8 #include <type_traits>
9 
15 
16 namespace vccc {
17 namespace ranges {
18 namespace detail {
19 
20 struct next_niebloid {
21  template<typename I>
23  operator()(I i) const {
24  ++i;
25  return i;
26  }
27 
29  constexpr I operator()(I i, iter_difference_t<I> n) const {
30  ranges::advance(i, n);
31  return i;
32  }
33 
34  template<typename I, typename S, std::enable_if_t<conjunction<
35  input_or_output_iterator<I>,
36  sentinel_for<S, I>
37  >::value, int> = 0>
38  constexpr I operator()(I i, S bound) const {
39  ranges::advance(i, bound);
40  return i;
41  }
42 
43  template<typename I, typename S, std::enable_if_t<conjunction<
44  input_or_output_iterator<I>,
45  sentinel_for<S, I>
46  >::value, int> = 0>
47  constexpr I operator()(I i, iter_difference_t<I> n, S bound) const {
48  ranges::advance(i, n, bound);
49  return i;
50  }
51 };
52 
53 } // namespace detail
54 
55 namespace niebloid {
56 
64 
65 VCCC_INLINE_OR_STATIC constexpr detail::next_niebloid next{};
66 
69 
70 } // namespace niebloid
71 using namespace niebloid;
72 
73 } // namespace ranges
74 } // namespace vccc
75 
76 #endif // VCCC_ITERATOR_NEXT_HPP_
constexpr VCCC_INLINE_OR_STATIC detail::advance_niebloid advance
Definition: advance.hpp:158
constexpr VCCC_INLINE_OR_STATIC detail::next_niebloid next
Definition: next.hpp:65
#define VCCC_INLINE_OR_STATIC
Definition: inline_or_static.hpp:9
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35