VCCC  2024.05
VisualCamp Common C++ library
bidirectional_iterator.hpp
Go to the documentation of this file.
1 //
2 // Created by cosge on 2023-12-03.
3 //
4 
5 #ifndef VCCC_ITERATOR_BIDIRECTIONAL_ITERATOR_HPP_
6 #define VCCC_ITERATOR_BIDIRECTIONAL_ITERATOR_HPP_
7 
8 #include <type_traits>
9 
15 
16 namespace vccc {
17 namespace detail {
18 
19 template<typename T, typename = void>
20 struct is_post_decrementable_bidi_iter : std::false_type {};
21 
22 template<typename T>
23 struct is_post_decrementable_bidi_iter<T, void_t<decltype( std::declval<T&>()-- )>>
24  : same_as<decltype( std::declval<T&>()-- ), T> {};
25 
27 struct bidirectional_iterator_impl : std::false_type {};
28 
29 template<typename I>
30 struct bidirectional_iterator_impl<I, true>
31  : conjunction<
32  derived_from<ITER_CONCEPT<I>, bidirectional_iterator_tag>,
33  is_pre_decrementable<I>,
34  is_post_decrementable_bidi_iter<I>
35  > {};
36 
37 } // namespace detail
38 
41 
42 
57 template<typename I>
58 struct bidirectional_iterator : detail::bidirectional_iterator_impl<I> {};
59 
61 
62 } // namespace vccc
63 
64 #endif // VCCC_ITERATOR_BIDIRECTIONAL_ITERATOR_HPP_
void void_t
Definition: void_t.hpp:19
Definition: matrix.hpp:495
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
specifies that a forward_iterator is a bidirectional iterator, supporting movement backwards
Definition: bidirectional_iterator.hpp:58