Function assign

Synopsis

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

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

Description

Assigns identifiers to an empty registry.

This function is intended for use in conjunction with data, size and destroyed.
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
There must be no entities still alive 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 634-639 in src/entt/entity/registry.hpp.

template<typename It>
void assign(It first, It last, const entity_type destroyed) {
    ENTT_ASSERT(!alive(), "Entities still alive");
    entities.assign(first, last);
    free_list = destroyed;
}





Add Discussion

Log in to comment