W3cubDocs

/C++

std::operator ==,!=,<,<=,>,>= (std::span)

template <class T, std::ptrdiff_t X, class U, std::ptrdiff_t Y>
constexpr bool operator==(std::span<T, X> l, std::span<U, Y> r);
(1)
template <class T, std::ptrdiff_t X, class U, std::ptrdiff_t Y>
constexpr bool operator!=(std::span<T, X> l, std::span<U, Y> r);
(2)
template <class T, std::ptrdiff_t X, class U, std::ptrdiff_t Y>
constexpr bool operator<(std::span<T, X> l, std::span<U, Y> r);
(3)
template <class T, std::ptrdiff_t X, class U, std::ptrdiff_t Y>
constexpr bool operator<=(std::span<T, X> l, std::span<U, Y> r);
(4)
template <class T, std::ptrdiff_t X, class U, std::ptrdiff_t Y>
constexpr bool operator>(std::span<T, X> l, std::span<U, Y> r);
(5)
template <class T, std::ptrdiff_t X, class U, std::ptrdiff_t Y>
constexpr bool operator>=(std::span<T, X> l, std::span<U, Y> r);
(6)

Lexicographically compare the contents of two spans.

1) Equivalent to return std::equal(l.begin(), l.end(), r.begin(), r.end());.
2) Equivalent to return !(l == r);.
3) Equivalent to return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());.
4) Equivalent to return !(r < l);.
5) Equivalent to return (r < l);.
6) Equivalent to return !(l < r);.

Parameters

l, r - spans to compare

Return value

The result of the comparison.

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/container/span/operator_cmp