EnTT v3.4.0
Changelog
-
config
:- Added
ENTT_IS_EMPTY
as an opaque way to recognize empty types (ENTT_DISABLE_ETO
affects also this variable).
- Added
-
core
:- Added
entt::id_type
as an user-friendly alternative forENTT_ID_TYPE
. - Added the
entt::type_index
class sfinae-friendly template to assign library wide sequential identifiers to types. - Added
entt::has_type_index[_v]
to know if a given typeT
has assigned a library wide sequential identifier. - Added
entt::integral_constant
as a shortcut for its standard counterpart.
- Added
-
entity
:- Added
registry::remove_all
to orphan entities. - Added
registry::patch<T>
to replace an object in-place. - Added
registry::on_update<T>
to attach listeners to observe changes. - Added
registry::emplace<T>
to assign components to multiple entities at once. - Added
registry::insert<T>
to assign components to entities. - Added
registry::get_or_emplace<T>
get a component and construct it if it doesn't exist yet. registry::replace
from arguments is no longer deprecated and still available.- Added
storage<T>::emplace
to assign objects to entities. - Added
storage<T>::insert
to assign objects to multiple entities at once. - Added
sparse_set::emplace
to assign objects to entities. - Added
sparse_set::insert
to assign objects to multiple entities at once. - Added
entt::invoke
, a shortcut to invoke members on components from callbacks. - Added
registry::destroy
with suggested version.
- Added
-
meta
:- Added
meta_type::detach
to make it possible to detach meta type from contexts (for example, during a visit). - Added a reviewed version of
meta_factory::type
that usestype_info<T>::id()
as a default initializer. - Added
meta_type::type_id
to get the type id of the underlying (erased) type. - Added
entt::resolve_if
to lookup meta types using custom predicates. - Added
entt::resolve_id
to lookup meta types by identifier. - Added
entt::resolve_type
to lookup meta types by type id. - Added
meta_any::ref
to invoke aliasing constructor and get references to unmanaged objects.
- Added
-
Performance improvements here and there (more devirtualization, less branches, ...).
Build system
homebrew-entt
is automatically updated on tags.- Updated installation process.
EnTT
across boundaries
It turned out that the latest version had a problem when multiple registries containing different component types were used concurrently from different threads (see #449 for further details).
Because of this, the way used to make EnTT
work across boundaries has changed and has been further refined. There exist now two paths within some of the data structure available in EnTT
: the default one (also known as indexed access) based on the type_index
class and its fallback based on the type_info
class.
In particular:
-
When
EnTT
is used standalone and its main classes (such as theregistry
) are not pushed across boundaries, there is nothing to worry about. -
In case of linked libraries and when exporting the necessary symbols isn't a problem, use the
ENTT_API_IMPORT
andENTT_API_EXPORT
definitions as appropriate. This will makeEnTT
use the indexed access even across boundaries. -
In all other cases, suppress the index generation to force
EnTT
to use a fallback:template<typename Type> struct entt::type_index<Type> {};
It's recommended to use range operations as much as possible in this case.
The lib
directory contains many examples for who's interested in the topic.
The meta system has not undergone any changes since its previous version.
Breaking changes
- Empty types are no longer returned nor are they available in any case.
- The
storage
class for empty types doesn't offer anymoreget
,try_get
and so on. - Views and groups no longer return empty types during a call to
each
and don't allow anymore toget
an empty type for an entity. ENTT_DISABLE_ETO
is no longer considered, useENTT_NO_ETO
instead.ENTT_ENABLE_ETO
is no longer exported, useENTT_IS_EMPTY
instead.
- The
iterator_type
aliases have been renamed toiterator
for better integration.meta_type::id
returns the type identifier rather than the type id.basic_snapshot<T>::entities
stores aside also destroyed entities, not only the ones still alive.basic_snapshot_loader<T>::entities
expects also destroyed entities, not only the ones still alive.basic_continuous_loader<T>::entities
expects also destroyed entities, not only the ones still alive.
Deprecated functions
All previously deprecated functions and classes have been removed.
This is the list of features deprecated with this release:
registry::replace
with callbacks, useregistry::patch
instead.registry::on_replace
, useregistry::on_update
instead.registry::assign<T>
for a single entity, useregistry::emplace<T>
instead.registry::assign<T>
for multiple entities, useregistry::insert<T>
instead.registry::get_or_assign<T>
, useregistry::get_or_emplace<T>
instead.registry::snapshot
,basic_snapshot<T>
has now a constructor that accepts a reference to a registry.registry::loader
,basic_snapshot_loader<T>
has now a constructor that accepts a reference to a registry.storage<T>::construct
for a single entity, usestorage<T>::emplace
instead.storage<T>::construct
for multiple entities, usestorage<T>::insert
instead.storage<T>::destroy
, usestorage<T>::erase
instead.sparse_set::construct
for a single entity, usesparse_set::emplace
instead.sparse_set::construct
for multiple entities, usesparse_set::insert
instead.sparse_set::destroy
, usesparse_set::erase
instead.sparse_set::has
, usesparse_set::contains
instead.group::less
, usegroup::each
instead.view::less
, useview::each
instead.meta_factory::alias
, usemeta_factory::type
instead.meta_type::alias
, usemeta_type::id
instead.meta_data::alias
, usemeta_data::id
instead.meta_func::alias
, usemeta_func::id
instead.entt::as_alias_t
andentt::as_alias
, useentt::as_ref_t
andentt::as_ref
instead.entt::resolve
by identifier, useentt::resolve_id
instead.observer::replace
, useobserver::update
instead.basic_snapshot<T>::destroyed
, usebasic_snapshot<T>::entities
instead.basic_snapshot_loader<T>::destroyed
, usebasic_snapshot_loader<T>::entities
instead.basic_continuous_loader<T>::destroyed
, usebasic_continuous_loader<T>::entities
instead.basic_continuous_loader::has
, usebasic_continuous_loader::contains
instead.
Any other business
The documentation is up-to-date and the library is battle-tested with 100% coverage as usual.
I've also updated the FAQs and the section EnTT
in Action with more and more examples.
I started a long term process to reduce the number of instantiations and therefore speed up the compilation.
This release contains some more changes in this regard. Still a work in progress though.