VCCC  2024.05
VisualCamp Common C++ library
prev.hpp
Go to the documentation of this file.
1 //
2 // Created by cosge on 2023-12-25.
3 //
4 
5 #ifndef VCCC_ITERATOR_PREV_HPP_
6 #define VCCC_ITERATOR_PREV_HPP_
7 
8 #include <type_traits>
9 
14 
15 namespace vccc {
16 namespace ranges {
17 namespace detail {
18 
19 struct prev_niebloid {
20  template<typename I>
22  operator()(I i) const {
23  --i;
24  return i;
25  }
26 
27  template<typename I>
29  operator()(I i, iter_difference_t<I> n) const {
30  ranges::advance(i, -n);
31  return i;
32  }
33 
34 
35  template<typename I>
37  operator()(I i, iter_difference_t<I> n, I bound) const {
38  ranges::advance(i, -n, bound);
39  return i;
40  }
41 };
42 
43 } // namespace detail
44 
45 namespace niebloid {
46 
52 
53 VCCC_INLINE_OR_STATIC constexpr detail::prev_niebloid prev{};
54 
57 
58 } // namespace niebloid
59 using namespace niebloid;
60 
61 } // namespace ranges
62 } // namespace vccc
63 
64 #endif // VCCC_ITERATOR_PREV_HPP_
constexpr VCCC_INLINE_OR_STATIC detail::advance_niebloid advance
Definition: advance.hpp:158
constexpr VCCC_INLINE_OR_STATIC detail::prev_niebloid prev
Definition: prev.hpp:53
#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