From 900d2bf8163e29aad7abdb7f77fa5de33a34ff4f Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 11 Mar 2022 16:03:20 +0100 Subject: [PATCH] meta: prepare meta_sequence_container::meta_iterator to model a bidirectional iterator --- src/entt/meta/meta.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index 7e1e50847..8625aca13 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -1445,16 +1445,16 @@ class meta_sequence_container::meta_iterator final { deref }; - using vtable_type = void(const operation, const any &, void *); + using vtable_type = void(const operation, const any &, const void *); template - static void basic_vtable(const operation op, const any &value, void *other) { + static void basic_vtable(const operation op, const any &value, const void *other) { switch(op) { case operation::incr: - ++any_cast(const_cast(value)); + any_cast(const_cast(value)) += *static_cast(other); break; case operation::deref: - static_cast(other)->emplace::reference>(*any_cast(value)); + static_cast(const_cast(other))->emplace::reference>(*any_cast(value)); break; } } @@ -1486,7 +1486,8 @@ public: /*! @brief Pre-increment operator. @return This iterator. */ meta_iterator &operator++() ENTT_NOEXCEPT { - return vtable(operation::incr, handle, nullptr), *this; + const std::ptrdiff_t diff{1}; + return vtable(operation::incr, handle, &diff), *this; } /*! @brief Post-increment operator. @return This iterator. */