Function combine

Synopsis

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

static constexpr value_type combine(const entity_type lhs, const entity_type rhs)

Description

Combines two identifiers in a single one.

The returned identifier is a copy of the first element except for its version, which is taken from the second element.

Parameters

lhs - The identifier from which to take the entity part.

rhs - The identifier from which to take the version part.

Returns
A properly constructed identifier.

Source

Lines 128-131 in src/entt/entity/entity.hpp.

[[nodiscard]] static constexpr value_type combine(const entity_type lhs, const entity_type rhs) ENTT_NOEXCEPT {
    constexpr auto mask = (base_type::version_mask << base_type::entity_shift);
    return value_type{(lhs & base_type::entity_mask) | (rhs & mask)};
}





Add Discussion

Log in to comment