Class meta_associative_container
Synopsis
#include <src/entt/meta/meta.hpp>
class meta_associative_container
Description
Proxy object for associative containers.
Mentioned in
- Runtime Reflection System / Container support
Classes
meta_iterator | Opaque iterator for meta associative containers. |
Methods
meta_associative_container overload | Default constructor. | |
meta_associative_container overload | Construct a proxy object for associative containers. | |
begin | Returns a meta iterator to the first element of the wrapped container. | |
clear | Clears the content of the wrapped container. | |
end | Returns a meta iterator that is past the last element of the wrapped container. | |
erase | Removes the specified element from the wrapped container. | |
find | Returns an iterator to the element with key equivalent to a given one, if any. | |
insert | Inserts an element (a key/value pair) into the wrapped container. | |
key_only | Returns true if the associative container is also key-only, false otherwise. | |
key_type | Returns the key meta type of the wrapped container type. | |
mapped_type | Returns the mapped meta type of the wrapped container type. | |
operator bool | Returns false if a proxy is invalid, true otherwise. | |
size | Returns the size of the wrapped container. | |
value_type | Returns the value meta type of the wrapped container type. |
Source
Lines 92-154 in src/entt/meta/meta.hpp.
class meta_associative_container {
template<typename>
struct meta_associative_container_proxy;
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_associative_container() ENTT_NOEXCEPT = default;
/**
* @brief Construct a proxy object for associative containers.
* @tparam Type Type of container to wrap.
* @param instance The container to wrap.
*/
template<typename Type>
meta_associative_container(std::in_place_type_t<Type>, any instance) ENTT_NOEXCEPT
: key_only_container{is_key_only_meta_associative_container_v<Type>},
key_type_fn{&meta_associative_container_proxy<Type>::key_type},
mapped_type_fn{&meta_associative_container_proxy<Type>::mapped_type},
value_type_fn{&meta_associative_container_proxy<Type>::value_type},
size_fn{&meta_associative_container_proxy<Type>::size},
clear_fn{&meta_associative_container_proxy<Type>::clear},
begin_fn{&meta_associative_container_proxy<Type>::begin},
end_fn{&meta_associative_container_proxy<Type>::end},
insert_fn{&meta_associative_container_proxy<Type>::insert},
erase_fn{&meta_associative_container_proxy<Type>::erase},
find_fn{&meta_associative_container_proxy<Type>::find},
storage{std::move(instance)}
{}
[[nodiscard]] inline bool key_only() const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type key_type() const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type mapped_type() const ENTT_NOEXCEPT;
[[nodiscard]] inline meta_type value_type() const ENTT_NOEXCEPT;
[[nodiscard]] inline size_type size() const ENTT_NOEXCEPT;
inline bool clear();
[[nodiscard]] inline iterator begin();
[[nodiscard]] inline iterator end();
inline bool insert(meta_any, meta_any);
inline bool erase(meta_any);
[[nodiscard]] inline iterator find(meta_any);
[[nodiscard]] inline explicit operator bool() const ENTT_NOEXCEPT;
private:
bool key_only_container{};
meta_type(* key_type_fn)() ENTT_NOEXCEPT = nullptr;
meta_type(* mapped_type_fn)() ENTT_NOEXCEPT = nullptr;
meta_type(* value_type_fn)() ENTT_NOEXCEPT = nullptr;
size_type(* size_fn)(const any &) ENTT_NOEXCEPT = nullptr;
bool(* clear_fn)(any &) = nullptr;
iterator(* begin_fn)(any &) = nullptr;
iterator(* end_fn)(any &) = nullptr;
bool(* insert_fn)(any &, meta_any &, meta_any &) = nullptr;
bool(* erase_fn)(any &, meta_any &) = nullptr;
iterator(* find_fn)(any &, meta_any &) = nullptr;
any storage{};
};