iterator_difference

namespace opentl {
    template <typename It>
    struct iterator_difference;

    template <typename It>
    using iterator_difference_t = typename iterator_difference<It>::type;
}

The difference type of an iterator.

Declared in <iterator/iterator_difference.hpp>.

Template Parameters

Name Description
It The iterator type.

Member Types

Type Description
type The difference type.

Aliases

Name Description
iterator_difference_t Helper alias for iterator_difference.

Remarks

The difference type is the one declared by the iterator as its difference_type member type, otherwise it is deduced from the difference of two iterators. The traits are empty when neither source is available.

Example

#include <opentl/iterator.hpp>

static_assert(opentl::same_as<opentl::iterator_difference_t<int*>, opentl::ptrdiff_t>);

int main() {}