libycxx

function object

std::ranges::distance

Scope
std::ranges

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);
    (1)
  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);
    (2)
  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);
    (3)