diff options
author | HampusM <hampus@hampusmat.com> | 2022-07-01 16:01:04 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-07-01 16:01:04 +0200 |
commit | 7307815e99a79dac42f2a9c06b0fe6171ea11ba0 (patch) | |
tree | ad41ee819dc87fc2653caf720fa7d1df30c0caeb /src/util/ranges_impl.hpp | |
parent | 2bff8c999edde11270ecaf6fbd2d24f54d0e360b (diff) |
refactor: use ranges
Diffstat (limited to 'src/util/ranges_impl.hpp')
-rw-r--r-- | src/util/ranges_impl.hpp | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/src/util/ranges_impl.hpp b/src/util/ranges_impl.hpp deleted file mode 100644 index 1f1a577..0000000 --- a/src/util/ranges_impl.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include "ranges.hpp" - -// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define IOTA_VIEW_ITERATOR(return_type) \ - template <std::weakly_incrementable Value> \ - constexpr return_type IotaViewIterator<Value> - -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 <std::weakly_incrementable Value, std::semiregular Bound> \ - requires std::equality_comparable_with<Value, Bound> && std::copyable<Value> \ - constexpr return_type IotaView<Value, Bound> - -IOTA_VIEW()::IotaView(Value value, Bound bound) noexcept : _value(value), _bound(bound) {} - -IOTA_VIEW(auto)::begin() const noexcept -> IotaViewIterator<Value> -{ - return IotaViewIterator(_value); -} - -IOTA_VIEW(auto)::end() const noexcept -> IotaViewIterator<Value> -{ - return IotaViewIterator(_bound); -} |