Function assign

Synopsis

#include <src/entt/entity/registry.hpp>

template <typename It>
void assign(It first, It last, const entity_type destroyed)

Description

Assigns entities to an empty registry.

This function is intended for use in conjunction with raw and assign.
Don't try to inject ranges of randomly generated entities nor the wrong head for the list of destroyed entities. There is no guarantee that a registry will continue to work properly in this case.

Warning
All pools must be empty for this to work properly.
Template Parameters

It - Type of input iterator.

Parameters

first - An iterator to the first element of the range of entities.

last - An iterator past the last element of the range of entities.

destroyed - The head of the list of destroyed entities.

Source

Lines 519-524 in src/entt/entity/registry.hpp.

template<typename It>
void assign(It first, It last, const entity_type destroyed) {
    ENTT_ASSERT(std::all_of(pools.cbegin(), pools.cend(), [](auto &&pdata) { return !pdata.pool || pdata.pool->empty(); }));
    entities.assign(first, last);
    available = destroyed;
}





Add Discussion

Log in to comment