function object
std::ranges::distance
- Header
<iterator>- Scope
std::ranges- cppreference
- std::ranges::distance
Synopsis
inline constexpr /* implementation-defined */ distance = {};Call signatures
distance is a function object; these are its call operators as libycxx declares them, written as the functions the draft declares.
- (1)
template<std::ranges::range R> constexpr std::ranges::range_difference_t<R> distance(R&& r); - (2)
template<std::input_or_output_iterator I, std::sentinel_for<I> S> requires (!std::sized_sentinel_for<S, I>) constexpr std::iter_difference_t<I> distance(I first, S last); - (3)
template<class I, std::sized_sentinel_for<std::decay_t<I>> S> constexpr std::iter_difference_t<std::decay_t<I>> distance( I&& first, S last);