From 33ccb715267f2f426d3f18afb42bddc0d7115dae Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 23 Jul 2021 15:51:26 +0200 Subject: [PATCH] meta: add cbegin/cend to meta_range --- src/entt/meta/range.hpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/entt/meta/range.hpp b/src/entt/meta/range.hpp index 7b54525fd..d68f38ce6 100644 --- a/src/entt/meta/range.hpp +++ b/src/entt/meta/range.hpp @@ -60,6 +60,8 @@ public: using node_type = Node; /*! @brief Input iterator type. */ using iterator = range_iterator; + /*! @brief Constant input iterator type. */ + using const_iterator = iterator; /*! @brief Default constructor. */ meta_range() ENTT_NOEXCEPT = default; @@ -76,19 +78,29 @@ public: * @brief Returns an iterator to the beginning. * @return An iterator to the first meta object of the range. */ - [[nodiscard]] iterator begin() const ENTT_NOEXCEPT { + [[nodiscard]] const_iterator cbegin() const ENTT_NOEXCEPT { return iterator{node}; } + /*! @copydoc cbegin */ + [[nodiscard]] iterator begin() const ENTT_NOEXCEPT { + return cbegin(); + } + /** * @brief Returns an iterator to the end. * @return An iterator to the element following the last meta object of the * range. */ - [[nodiscard]] iterator end() const ENTT_NOEXCEPT { + [[nodiscard]] const_iterator cend() const ENTT_NOEXCEPT { return iterator{}; } + /*! @copydoc cend */ + [[nodiscard]] iterator end() const ENTT_NOEXCEPT { + return cend(); + } + private: node_type *node{nullptr}; };