EnTT 4.0.0
Loading...
Searching...
No Matches
entt::basic_meta_associative_container_traits< Type > Struct Template Reference

General purpose implementation of meta associative container traits. More...

#include <container.hpp>

Inheritance diagram for entt::basic_meta_associative_container_traits< Type >:

Public Types

using size_type = meta_associative_container::size_type
 Unsigned integer type.
using iterator = meta_associative_container::iterator
 Meta iterator type.

Static Public Member Functions

static size_type size (const void *container)
 Returns the number of elements in a container.
static bool clear (void *container)
 Clears a container.
static bool reserve (void *container, const size_type sz)
 Increases the capacity of a container.
static iterator iter (const meta_ctx &area, void *container, const void *as_const, const bool end)
 Returns a possibly const iterator to the beginning or the end.
static bool insert (void *container, const void *key, const void *value)
 Inserts an element into a container, if the key does not exist.
static size_type erase (void *container, const void *key)
 Removes an element from a container.
static iterator find (const meta_ctx &area, void *container, const void *as_const, const void *key)
 Finds an element with a given key.

Static Public Attributes

static constexpr bool key_only = !requires { typename Type::mapped_type; }
 True in case of key-only containers, false otherwise.

Detailed Description

template<cvref_unqualified Type>
struct entt::basic_meta_associative_container_traits< Type >

General purpose implementation of meta associative container traits.

Template Parameters
TypeType of underlying associative container.

Definition at line 185 of file container.hpp.

Member Typedef Documentation

◆ iterator

template<cvref_unqualified Type>
using entt::basic_meta_associative_container_traits< Type >::iterator = meta_associative_container::iterator

Meta iterator type.

Definition at line 189 of file container.hpp.

◆ size_type

template<cvref_unqualified Type>
using entt::basic_meta_associative_container_traits< Type >::size_type = meta_associative_container::size_type

Unsigned integer type.

Definition at line 187 of file container.hpp.

Member Function Documentation

◆ clear()

template<cvref_unqualified Type>
bool entt::basic_meta_associative_container_traits< Type >::clear ( void * container)
inlinestaticnodiscard

Clears a container.

Parameters
containerOpaque pointer to a container of the given type.
Returns
True in case of success, false otherwise.

Definition at line 208 of file container.hpp.

◆ erase()

template<cvref_unqualified Type>
size_type entt::basic_meta_associative_container_traits< Type >::erase ( void * container,
const void * key )
inlinestaticnodiscard

Removes an element from a container.

Parameters
containerOpaque pointer to a container of the given type.
keyAn opaque key value of an element to remove.
Returns
Number of elements removed (either 0 or 1).

Definition at line 264 of file container.hpp.

◆ find()

template<cvref_unqualified Type>
iterator entt::basic_meta_associative_container_traits< Type >::find ( const meta_ctx & area,
void * container,
const void * as_const,
const void * key )
inlinestatic

Finds an element with a given key.

Parameters
areaThe context to pass to the newly created iterator.
containerOpaque pointer to a container of the given type.
as_constConst opaque pointer fallback.
keyOpaque key value of an element to search for.
Returns
An iterator to the element with the given key, if any.

Definition at line 276 of file container.hpp.

◆ insert()

template<cvref_unqualified Type>
bool entt::basic_meta_associative_container_traits< Type >::insert ( void * container,
const void * key,
const void * value )
inlinestaticnodiscard

Inserts an element into a container, if the key does not exist.

Parameters
containerOpaque pointer to a container of the given type.
keyAn opaque key value of an element to insert.
valueOptional opaque value to insert (key-value containers).
Returns
True if the insertion took place, false otherwise.

Definition at line 250 of file container.hpp.

◆ iter()

template<cvref_unqualified Type>
iterator entt::basic_meta_associative_container_traits< Type >::iter ( const meta_ctx & area,
void * container,
const void * as_const,
const bool end )
inlinestatic

Returns a possibly const iterator to the beginning or the end.

Parameters
areaThe context to pass to the newly created iterator.
containerOpaque pointer to a container of the given type.
as_constConst opaque pointer fallback.
endFalse to get a pointer that is past the last element.
Returns
An iterator to the first or past the last element of the container.

Definition at line 237 of file container.hpp.

◆ reserve()

template<cvref_unqualified Type>
bool entt::basic_meta_associative_container_traits< Type >::reserve ( void * container,
const size_type sz )
inlinestaticnodiscard

Increases the capacity of a container.

Parameters
containerOpaque pointer to a container of the given type.
szDesired capacity.
Returns
True in case of success, false otherwise.

Definition at line 219 of file container.hpp.

◆ size()

template<cvref_unqualified Type>
size_type entt::basic_meta_associative_container_traits< Type >::size ( const void * container)
inlinestaticnodiscard

Returns the number of elements in a container.

Parameters
containerOpaque pointer to a container of the given type.
Returns
Number of elements.

Definition at line 199 of file container.hpp.

Member Data Documentation

◆ key_only

template<cvref_unqualified Type>
bool entt::basic_meta_associative_container_traits< Type >::key_only = !requires { typename Type::mapped_type; }
staticconstexpr

True in case of key-only containers, false otherwise.

Definition at line 192 of file container.hpp.


The documentation for this struct was generated from the following file: