Class meta_sequence_container

Synopsis

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

class meta_sequence_container

Description

Proxy object for sequence containers.

Mentioned in

Classes

meta_iteratorOpaque iterator for sequence containers.

Methods

meta_sequence_container overloadDefault constructor.
meta_sequence_container overloadConstruct a proxy object for sequence containers.
beginReturns an iterator to the first element of a container.
clearClears the content of a container.
endReturns an iterator that is past the last element of a container.
eraseRemoves a given element from a container.
insertInserts an element at a specified location of a container.
operator boolReturns false if a proxy is invalid, true otherwise.
operator[]Returns a reference to the element at a given location of a container (no bounds checking is performed).
resizeResizes a container to contain a given number of elements.
sizeReturns the size of a container.
value_typeReturns the meta value type of a container.

Source

Lines 31-84 in src/entt/meta/meta.hpp.

class meta_sequence_container {
    class meta_iterator;

public:
    /*! @brief Unsigned integer type. */
    using size_type = std::size_t;
    /*! @brief Meta iterator type. */
    using iterator = meta_iterator;

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

    /**
     * @brief Construct a proxy object for sequence containers.
     * @tparam Type Type of container to wrap.
     * @param instance The container to wrap.
     */
    template<typename Type>
    meta_sequence_container(std::in_place_type_t<Type>, any instance) ENTT_NOEXCEPT
        : value_type_node{internal::meta_info<typename Type::value_type>::resolve()},
          size_fn{&meta_sequence_container_traits<Type>::size},
          resize_fn{&meta_sequence_container_traits<Type>::resize},
          clear_fn{&meta_sequence_container_traits<Type>::clear},
          begin_fn{&meta_sequence_container_traits<Type>::begin},
          end_fn{&meta_sequence_container_traits<Type>::end},
          insert_fn{&meta_sequence_container_traits<Type>::insert},
          erase_fn{&meta_sequence_container_traits<Type>::erase},
          get_fn{&meta_sequence_container_traits<Type>::get},
          storage{std::move(instance)}
    {}

    [[nodiscard]] inline meta_type value_type() const ENTT_NOEXCEPT;
    [[nodiscard]] inline size_type size() const ENTT_NOEXCEPT;
    inline bool resize(const size_type);
    inline bool clear();
    [[nodiscard]] inline iterator begin();
    [[nodiscard]] inline iterator end();
    inline iterator insert(iterator, meta_any);
    inline iterator erase(iterator);
    [[nodiscard]] inline meta_any operator[](const size_type);
    [[nodiscard]] inline explicit operator bool() const ENTT_NOEXCEPT;

private:
    internal::meta_type_node *value_type_node = nullptr;
    size_type(* size_fn)(const any &) ENTT_NOEXCEPT = nullptr;
    bool(* resize_fn)(any &, size_type) = nullptr;
    bool(* clear_fn)(any &) = nullptr;
    iterator(* begin_fn)(any &) = nullptr;
    iterator(* end_fn)(any &) = nullptr;
    iterator(* insert_fn)(any &, iterator, meta_any &) = nullptr;
    iterator(* erase_fn)(any &, iterator) = nullptr;
    meta_any(* get_fn)(any &, size_type) = nullptr;
    any storage{};
};





Add Discussion

Log in to comment