#pragma once #include "ranges.hpp" // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define IOTA_VIEW_ITERATOR(return_type) \ template \ constexpr return_type IotaViewIterator IOTA_VIEW_ITERATOR()::IotaViewIterator(Value value) noexcept : _value(value) {} IOTA_VIEW_ITERATOR(auto)::operator++() noexcept -> const IotaViewIterator & { ++_value; return *this; } IOTA_VIEW_ITERATOR(auto)::operator++(int) noexcept -> IotaViewIterator { auto copy = *this; ++(*this); return copy; } IOTA_VIEW_ITERATOR(auto)::operator*() const noexcept -> Value { return _value; } IOTA_VIEW_ITERATOR(auto)::operator==(const IotaViewIterator &rhs) const noexcept -> bool { return _value == rhs._value; } IOTA_VIEW_ITERATOR(auto)::operator!=(const IotaViewIterator &rhs) const noexcept -> bool { return !(*this == rhs); } // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define IOTA_VIEW(return_type) \ template \ requires std::equality_comparable_with && std::copyable \ constexpr return_type IotaView IOTA_VIEW()::IotaView(Value value, Bound bound) noexcept : _value(value), _bound(bound) {} IOTA_VIEW(auto)::begin() const noexcept -> IotaViewIterator { return IotaViewIterator(_value); } IOTA_VIEW(auto)::end() const noexcept -> IotaViewIterator { return IotaViewIterator(_bound); }