From 8ec9b5841e9eef602f7b9ae8f8824eb799bf4c28 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 9 Sep 2024 23:21:23 +0200 Subject: Core/DataStores: Refactor DBStorageIterator to make it usable with more std::ranges algorithms --- src/server/shared/DataStores/DB2Store.h | 2 +- src/server/shared/DataStores/DBStorageIterator.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/server/shared') diff --git a/src/server/shared/DataStores/DB2Store.h b/src/server/shared/DataStores/DB2Store.h index 42afd22335f..362155552b2 100644 --- a/src/server/shared/DataStores/DB2Store.h +++ b/src/server/shared/DataStores/DB2Store.h @@ -76,7 +76,7 @@ class DB2Storage : public DB2StorageBase static_assert(std::is_standard_layout_v, "T in DB2Storage must have standard layout."); public: - using iterator = DBStorageIterator; + using iterator = DBStorageIterator; using DB2StorageBase::DB2StorageBase; diff --git a/src/server/shared/DataStores/DBStorageIterator.h b/src/server/shared/DataStores/DBStorageIterator.h index 6df777c76c9..0ccb1be5079 100644 --- a/src/server/shared/DataStores/DBStorageIterator.h +++ b/src/server/shared/DataStores/DBStorageIterator.h @@ -32,7 +32,7 @@ public: using reference = T&; DBStorageIterator() : _index(nullptr), _pos(0), _end(0) { } - DBStorageIterator(T const* const* index, uint32 size, uint32 pos = 0) : _index(index), _pos(pos), _end(size) + DBStorageIterator(value_type const* index, uint32 size, uint32 pos = 0) : _index(index), _pos(pos), _end(size) { if (_pos < _end) { @@ -41,8 +41,8 @@ public: } } - T const* operator->() const { return _index[_pos]; } - T const* operator*() const { return _index[_pos]; } + value_type const& operator->() const { return _index[_pos]; } + value_type const& operator*() const { return _index[_pos]; } bool operator==(DBStorageIterator const& right) const { /*ASSERT(_index == right._index, "Iterator belongs to a different container")*/ return _pos == right._pos; } @@ -66,7 +66,7 @@ public: } private: - T const* const* _index; + value_type const* _index; uint32 _pos; uint32 _end; }; -- cgit v1.2.3