Changelog
Short version (aka most wanted/relevant changes)
- Stamp is back. 😄
- Truly const and therefore const thread safe
registry
. meta_any
as well as the newany
class support const references.- I've added the
organizer
class to create a minimal dependency graph for your systems. - The
EnTT
type system was improved andtype_info
is now an opaque type returnd bytype_id<T>
. - There is a new module called
poly
for automated static polymorphism. - Full support for custom pools is finally a (very important) thing.
Long version (aka all you can find in v3.6.0)
-
config
:- Reintroduced
ENTT_DISABLE_ASSERT
to fully disable asserts.
- Reintroduced
-
core
:- Added sfinae-friendly class
type_seq
to provide sequential identifiers for types. - Added sfinae-friendly class
type_hash
to provide unique identifiers for types. - Added sfinae-friendly class
type_name
to provide demangled names for types. - Added untyped class
type_info
as a replacement for the template classtype_info<T>
. - Added
type_id
function template to generate untypedtype_info
objects from types:auto info = entt::type_id<a_type>();
- Added utility
type_list_contains[_v]
. - Added
size_of_v
, an extension forsizeof
that doesn't complain when used with functions or incomplete types. - Added
type_list<T...>::size
to know the number of types of a type list. - Added
operator+
for type lists (similar totype_list_cat[_t]
, but for variables rather than types):constexpr auto list = entt::type_list<int, char>{} + entt::type_list<double>{};
- Added traits
is_applicable[_v]
andis_applicable_r[_v]
, a sort ofstd::is_invocable
with tuples. - Added trait
is_empty[_v]
(mainly used for internal purposes) that is true only ifENTT_NO_ETO
isn't defined. - Updated default page size (
ENTT_PAGE_SIZE
) to 4096. hashed_string::value
is nowconstexpr
, suitable for uses with string views in constant expressions.- Added trait
constness_as[_t]
to transfer the constness between types. - User defined literals for hashed strings (
_hs
and_hws
) have been moved to the namespaceentt::literals
. - Added trait
is_complete[_v]
to detect complete types. - Standalone, branchless implementation of
entt::any
with a default SBO size ofsizeof(double[2])
. entt::any
support for both const and non-const references (extended to meta and poly, see below).- Added
entt::any_cast
overloads similar to what the standard library offers. - Added
as_ref
to create aliases to unmanaged objects withany
. - Added
value_list
andvalue_list_cat[_t]
(similar totype_list
andtype_list_cast[_t]
, but for values rather than types). - Added
type_identity[_t]
trait (waiting for a C++20 version ofEnTT
). - Added
type_list_element[_t]
fortype_list
s, similar tostd::tuple_element_t
. - Added
value_list_element[_v]
forvalue_list
s, similar tostd::tuple_element_t
.
- Added sfinae-friendly class
-
entity
:- Full support for custom storage/views (🥳). This is HUGE, even if at the moment it lacks proper documentation.
storage_adapter_mixin
andsigh_pool_mixin
are now independent from each other. It's also easy to set a signal-less default pool:template<typename Entity, typename Type> struct pool<Entity, Type> { using type = storage_adapter_mixin<basic_storage<Entity, Type>>; };
- Added multi-type view
::size_hint
member function. registry::visit
andregistry::ctx
return now a wholetype_info
object rather than the sole identifier.- It's now possible to create truly invalid instances of
entt::handle
. - Added the new class
organizer
to create a minimal dependency graph for your systems, see the documentation for further details. storage::emplace
returns now the newly created object.- Introduced the alias
value_type
as a replacement forobject_type
(storage, pool). - Added
basic_group<...>::each()
andbasic_view<...>::each()
as a replacement for::proxy
. - Reduced scope for candidate selection in views.
- Extended get for views and groups:
auto [pos, vel] = registry.view<position, velocity>().get(entity);
- Added the
view_pack
class template to combine views and decide what type leads the iteration:
The intended use for this tool is with custom storage/views, but it's also useful in everyday uses.for(auto entity: registry.view<position>() | registry.view<velocity>()) { // ... }
The view pack is a view-like object, similar to a multi-type view. It's also iterable and it offers botheach(func)
andeach()
as well:
A view pack converts to references to its views. See the documentation for further details.for(auto [entity, pos, vel]: (registry.view<position>() | registry.view<velocity>()).each()) { // ... }
- Callbacks with entity are now the first choice for views and groups.
- Iterable views and groups (
each()
) also offer reverse iterators. registry::assign
also requires the head of the list of destroyed entities now and is much (much!) faster.- Added
registry::destroyed
to get the head of the list of destroyed entities (to use with::raw
and::assign
). - Added
view<...>::use<T>
to multi-type views to force the pool to use a given storage (useful when using iterators). - Added the
handle_view
class, a more restricted version ofhandle
which also specifies the types it operates on (conversion operators available). - Relaxed the requirement to expose a
try_get
member functions for (custom) storage classes. - Added the
entt::get_as_tuple
function to get the content of a storage given an entity as a (possibly empty) tuple. - Added the sfinae-friendly
storage_traits
class to provide information on storage classes. - Views constructors are public now, it's possible to create views from custom or externally managed storage.
- Added runtime view
::size_hint
member function. - Default constructible, invalid (pool-less) groups, views and runtime views.
- Truly const and therefore const thread safe
registry
(currently based on pool-less views). - Support for destroying entities from a handle (namely
basic_handle<Entity>::destroy
). - Added
poly_storage
, fully customizablepoly_storage_traits
and const/non-constregistry::storage
for opaque proxies to pools (aka welcome back stamp, copy, ...). 🙂 - Added
registry::reserve_pools
to reserve enough storage for pools when needed.
-
meta
:- Added opaque
meta_type::size_of
to know the size of the underlying type. - Added
meta_type::info
as a replacement formeta_type::hash
. - Extended
resolve
, it accepts now a type as a template parameter, or an unique identifier or type info object as an argument. - Meta functions and meta constructors finally support external functions:
entt::meta<Type>().type("Type"_hs).func<&entt::registry::emplace_or_replace<Type>, entt::as_ref_t>("emplace"_hs);
- Added meta function overload support.
- Container traits are no longer an internal details only.
- A
meta_any
that doesn't contain a pointer-like object can be safely dereferenced and will return an invalid instance. meta_any
usesentt::any
internally rather thanmeta_storage
.- Reduced instantiations due to
meta_any
using a single fake vtable function internally. - Added
as_ref
to create aliases to unmanaged objects withmeta_any
. - Support for const references when working with aliased objects.
- Added the
as_cref_t
policy to receive data members and return values as const references. - Pointer-like types to const elements return wrapped const references rather than making a copy of the pointed object.
- Meta containers support for const containers, their const iterators and const references to their elements.
- Added
meta_any::allow_cast
as a better, more flexible alternative formeta_any::convert
. - Added const and non-const overloads of
meta_any::get
andmeta_any::invoke
. - Direct alias constructor for
meta_any
:int value = 42; entt::meta_any any{std::in_place_type<int>, &value};
- Added const and non-const overloads for
operator*
,as_sequence_container
andas_associative_container
tometa_any
. - Support for pointer-like types with a custom dereference operator other than
operator*
.
- Added opaque
-
poly
:- Added a new module called
poly
for automated static polymorphism.
See the official documentation for all the details and usage instructions.
- Added a new module called
-
signal
:- Truly const and therefore const thread safe
emitter
.
- Truly const and therefore const thread safe
-
The single include file also contains the version now.
-
Allow compilation for Windows with GNU-like compilers.
-
Performance improvements here and there (
registry::create
,registry::clear
, storageremove
and range-remove
, ...).
Breaking changes
-
config
ENTT_STANDALONE
has been removed.ENTT_HS_SUFFIX
has been removed.ENTT_HWS_SUFFIX
has been removed.
-
core
:type_index
has been removed, usetype_seq
instead.has_type_index[_v]
utility has been removed.type_info
is not longer a class template. See the untyped version oftype_info
, thetype_id
function template, other thantype_seq
,type_hash
andtype_name
for further details.- Removed
type_list_size[_v]
, usetype_list<T...>::size
instead. is_eto_eligible[_v]
is nowis_empty[_v]
.- Importing
entt::literals
namespace is required in order to use user defined literals for hashed strings (_hs
and_hws
).
-
entity
:registry::visit
andregistry::ctx
return now a wholetype_info
object rather than the sole identifier.- Removed multi-type view
::empty
because it was misleading, use::size_hint
instead. - Removed multi-type view
::size
because it was misleading, use::size_hint
instead. - Removed multi-type view
::size<T>
,raw<T>
anddata<T>
because they were misleading. - Removed the alias
object_type
, usevalue_type
instead (storage, pool). - Removed
basic_group<...>::proxy
andbasic_view<...>::proxy
, use::each()
instead. - Single type views return an
std::tuple<T>
when the type isn't provided to the::get
member function (uniformity purpose for extended selection). - Callbacks with entity are now the first choice for views and groups.
registry::assign
also requires the head of the list of destroyed entities (see::destroyed
).- Removed chunked iteration for multi-type views, there was no way to make it consistent across all views with custom storage.
pool_traits
is replaced bystorage_traits
.- Removed member functions
::size<T>
,::empty<T..>
anddata<T>
from groups, they provide misleading information. - Reduced the scope of the member function
::raw
for groups, it provides misleading information. - Removed runtime view
::empty
because it was misleading, use::size_hint
instead. - Removed runtime view
::size
because it was misleading, use::size_hint
instead.
-
meta
:- Removed
meta_type::hash
, usemeta_type::info
instead. - Removed
resolve_id
, useresolve
instead. - Removed
resolve_type
, useresolve
instead. - Removed
meta_storage
, replaced byentt::any
. - Removed
as_ref
tag, no replacement available. - Removed
meta_any::ref
, useas_ref(any)
instead. - Removed
meta_any::convert
, usemeta_any::allow_cast
instead.
- Removed
-
EnTT
across boundaries:- Standalone mode is now the default.
To make EnTT work across boundaries, you've to provide support for contiguous identifiers.
See the examples in thetest
directory for more details.
- Standalone mode is now the default.
Deprecated features
All previously deprecated functions and classes have been removed.
This release contains many breaking changes. There was no way to make a smooth transition because of the amount and nature of these changes.
Because of that, I decided to not deprecate functions when possible and remove them directly instead.
See the above section for a migration guide.
Examples
I'm adding some examples (see test/example
) to answer the most frequently asked questions.
Custom storage/views also deserve a fair number of examples. I'll add them time by time as possible.
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.
There are a couple of extra pages available in the documentation:
- UE4 usage instructions.
poly
module.
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.