Skip to content

Commit

Permalink
Revert "[libc] Add reverse_iterator comparisons (#86147)"
Browse files Browse the repository at this point in the history
This reverts commit c96b61a.
  • Loading branch information
gchatelet committed Mar 21, 2024
1 parent c96b61a commit 23d6e75
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions libc/src/__support/CPP/iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ namespace cpp {
template <typename T> struct iterator_traits;
template <typename T> struct iterator_traits<T *> {
using reference = T &;
using value_type = T;
};

template <typename Iter> class reverse_iterator {
Iter current;

public:
using reference = typename iterator_traits<Iter>::reference;
using value_type = typename iterator_traits<Iter>::value_type;
using iterator_type = Iter;

LIBC_INLINE reverse_iterator() : current() {}
LIBC_INLINE constexpr explicit reverse_iterator(Iter it) : current(it) {}
Expand All @@ -41,38 +38,6 @@ template <typename Iter> class reverse_iterator {
LIBC_INLINE constexpr explicit reverse_iterator(const Other &it)
: current(it) {}

LIBC_INLINE friend constexpr bool operator==(const reverse_iterator &lhs,
const reverse_iterator &rhs) {
return lhs.base() == rhs.base();
}

LIBC_INLINE friend constexpr bool operator!=(const reverse_iterator &lhs,
const reverse_iterator &rhs) {
return lhs.base() != rhs.base();
}

LIBC_INLINE friend constexpr bool operator<(const reverse_iterator &lhs,
const reverse_iterator &rhs) {
return lhs.base() > rhs.base();
}

LIBC_INLINE friend constexpr bool operator<=(const reverse_iterator &lhs,
const reverse_iterator &rhs) {
return lhs.base() >= rhs.base();
}

LIBC_INLINE friend constexpr bool operator>(const reverse_iterator &lhs,
const reverse_iterator &rhs) {
return lhs.base() < rhs.base();
}

LIBC_INLINE friend constexpr bool operator>=(const reverse_iterator &lhs,
const reverse_iterator &rhs) {
return lhs.base() <= rhs.base();
}

LIBC_INLINE constexpr iterator_type base() const { current; }

LIBC_INLINE constexpr reference operator*() const {
Iter tmp = current;
return *--tmp;
Expand Down

0 comments on commit 23d6e75

Please sign in to comment.