72 lines
2.1 KiB
C++
72 lines
2.1 KiB
C++
|
/***
|
||
|
Copyright (C) 2024 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: auReverseIterator.hpp
|
||
|
Date: 2024-08-31
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#pragma once
|
||
|
|
||
|
template<typename Iterator>
|
||
|
struct AuReverseIterator
|
||
|
{
|
||
|
using iterator_type = Iterator;
|
||
|
|
||
|
using iterator_category = std::iterator_traits<Iterator>;
|
||
|
using value_type = typename std::iterator_traits<Iterator>::value_type;
|
||
|
using difference_type = typename std::iterator_traits<Iterator>::difference_type;
|
||
|
using pointer = typename std::iterator_traits<Iterator>::pointer;
|
||
|
using reference = typename std::iterator_traits<Iterator>::reference;
|
||
|
|
||
|
template <class>
|
||
|
friend struct AuReverseIterator;
|
||
|
|
||
|
constexpr AuReverseIterator() = default;
|
||
|
|
||
|
constexpr explicit AuReverseIterator(Iterator that);
|
||
|
|
||
|
template<typename Other_t>
|
||
|
constexpr AuReverseIterator(const AuReverseIterator<Other_t> &that);
|
||
|
|
||
|
template <class Other_t>
|
||
|
constexpr AuReverseIterator &operator=(const AuReverseIterator<Other_t> &that);
|
||
|
|
||
|
constexpr Iterator base() const;
|
||
|
constexpr Iterator Base() const;
|
||
|
|
||
|
constexpr reference operator*() const;
|
||
|
|
||
|
constexpr pointer operator->() const;
|
||
|
|
||
|
constexpr AuReverseIterator &operator++();
|
||
|
|
||
|
constexpr AuReverseIterator operator++(int);
|
||
|
|
||
|
constexpr AuReverseIterator &operator--();
|
||
|
|
||
|
constexpr AuReverseIterator operator--(int);
|
||
|
|
||
|
constexpr AuReverseIterator operator+(const difference_type offset) const;
|
||
|
|
||
|
constexpr AuReverseIterator &operator+=(const difference_type offset);
|
||
|
|
||
|
constexpr AuReverseIterator operator-(const difference_type offset) const;
|
||
|
|
||
|
constexpr AuReverseIterator &operator-=(const difference_type offset);
|
||
|
|
||
|
constexpr reference operator[](const difference_type offset) const;
|
||
|
|
||
|
constexpr friend bool operator!=(AuReverseIterator<Iterator> a, AuReverseIterator<Iterator> b)
|
||
|
{
|
||
|
return a.base() != b.base();
|
||
|
}
|
||
|
|
||
|
constexpr friend bool operator==(AuReverseIterator<Iterator> a, AuReverseIterator<Iterator> b)
|
||
|
{
|
||
|
return a.base() == b.base();
|
||
|
}
|
||
|
|
||
|
protected:
|
||
|
Iterator iterator;
|
||
|
};
|