VCCC  2024.05
VisualCamp Common C++ library
iter_difference_t.hpp
Go to the documentation of this file.
1 //
2 // Created by cosge on 2023-12-03.
3 //
4 
5 #ifndef VCCC_ITERATOR_ITER_DIFFERENCE_T_HPP_
6 #define VCCC_ITERATOR_ITER_DIFFERENCE_T_HPP_
7 
12 
13 namespace vccc {
14 namespace detail {
15 
16 template<
17  typename T,
18  bool = is_primary_iterator_traits< cxx20_iterator_traits< remove_cvref_t<T> > >::value,
19  bool = has_typename_difference_type<incrementable_traits<remove_cvref_t<T>>>::value
20 >
21 struct iter_difference_impl {};
22 
23 template<typename T, bool v>
24 struct iter_difference_impl<T, false, v> {
25  using type = typename cxx20_iterator_traits<remove_cvref_t<T>>::difference_type;
26 };
27 
28 template<typename T>
29 struct iter_difference_impl<T, true, true> {
30  using type = typename incrementable_traits<remove_cvref_t<T>>::difference_type;
31 };
32 
33 } // namespace detail
34 
37 
38 template<typename T>
39 struct iter_difference : detail::iter_difference_impl<T> {};
40 
48 template<typename T>
50 
52 
53 } // namespace vccc
54 
55 #endif // VCCC_ITERATOR_ITER_DIFFERENCE_T_HPP_
typename iter_difference< T >::type iter_difference_t
Computes the difference type of T
Definition: iter_difference_t.hpp:49
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
Definition: iter_difference_t.hpp:39