mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/DataStores: Refactor DBStorageIterator to make it usable with more std::ranges algorithms
This commit is contained in:
@@ -76,7 +76,7 @@ class DB2Storage : public DB2StorageBase
|
||||
static_assert(std::is_standard_layout_v<T>, "T in DB2Storage must have standard layout.");
|
||||
|
||||
public:
|
||||
using iterator = DBStorageIterator<T>;
|
||||
using iterator = DBStorageIterator<T const*>;
|
||||
|
||||
using DB2StorageBase::DB2StorageBase;
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user