6#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ITERATOR_ITER_DIFFERENCE_T_HPP_
7#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ITERATOR_ITER_DIFFERENCE_T_HPP_
16#include "arene/base/stdlib_choice/enable_if.hpp"
17#include "arene/base/stdlib_choice/iterator_traits.hpp"
18#include "arene/base/stdlib_choice/remove_cv.hpp"
19#include "arene/base/stdlib_choice/remove_reference.hpp"
26namespace iter_difference_t_detail {
30template <
typename Itr>
31using use_iterator_traits_difference_type =
typename std::iterator_traits<Itr>::difference_type;
35template <
typename Itr>
40template <
typename Itr>
41using use_incrementable_traits_difference_type =
typename incrementable_traits<Itr>::difference_type;
45template <
typename Itr>
46constexpr bool has_incrementable_traits_difference_type_v =
51template <
typename Itr,
typename = constra
ints<>>
52class iter_difference_t_impl {};
57template <
typename Itr>
58class iter_difference_t_impl<Itr,
constraints<std::
enable_if_t<has_iterator_traits_difference_type_v<Itr>>>> {
61 using type =
typename std::iterator_traits<Itr>::difference_type;
68template <
typename Itr>
69class iter_difference_t_impl<
72 std::
enable_if_t<!has_iterator_traits_difference_type_v<Itr>>,
76 using type =
typename incrementable_traits<Itr>::difference_type;
86template <
typename Itr>
87using iter_difference_t =
typename iter_difference_t_detail::iter_difference_t_impl<remove_cvref_t<Itr>>::type;
Definition accumulate.hpp:37
constexpr bool substitution_succeeds
Determines if a template can be instantiated successfully, similar to C++20's requires clause.
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
typename iter_difference_t_detail::iter_difference_t_impl< remove_cvref_t< Itr > >::type iter_difference_t
Computes the difference type of the given iterator type.
Definition iter_difference_t.hpp:87
Definition accumulate.hpp:36
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41