Struct meta_range

Synopsis

#include <src/entt/meta/range.hpp>

template<typename Type, typename Node = typename Type::node_type>
struct meta_range final

Description

Iterable range to use to iterate all types of meta objects.

Template Parameters

Type - Type of meta objects returned.

Node - Type of meta nodes iterated.

Methods

meta_range overloadDefault constructor.
meta_range overloadConstructs a meta range from a given node.
beginReturns an iterator to the beginning.
cbeginReturns an iterator to the beginning.
cendReturns an iterator to the end.
endReturns an iterator to the end.

Source

Lines 73-121 in src/entt/meta/range.hpp.

template<typename Type, typename Node = typename Type::node_type>
struct meta_range final {
    /*! @brief Node type. */
    using node_type = Node;
    /*! @brief Input iterator type. */
    using iterator = internal::meta_range_iterator<Type, Node>;
    /*! @brief Constant input iterator type. */
    using const_iterator = iterator;

    /*! @brief Default constructor. */
    meta_range() ENTT_NOEXCEPT = default;

    /**
     * @brief Constructs a meta range from a given node.
     * @param head The underlying node with which to construct the range.
     */
    meta_range(node_type *head) ENTT_NOEXCEPT
        : node{head} {}

    /**
     * @brief Returns an iterator to the beginning.
     * @return An iterator to the first meta object of the range.
     */
    [[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]] const_iterator cend() const ENTT_NOEXCEPT {
        return iterator{};
    }

    /*! @copydoc cend */
    [[nodiscard]] iterator end() const ENTT_NOEXCEPT {
        return cend();
    }

private:
    node_type *node{nullptr};
};





Add Discussion

Log in to comment