Releases: skypjack/entt
EnTT v3.10.2
Changelog
entity
:- Fix an issue that makes sparse set cross range-erase break when using built-in iterators.
Any other business
The documentation is up-to-date and the library is battle-tested with 100% coverage as usual.
EnTT v3.10.1
Changelog
-
config
:- Decouple
ENTT_NOEXCEPT
and exceptions handling
- Decouple
-
entity
:- Correctly handle overflow of version and max number of entities
-
meta
:- Container traits don't really support plain arrays anymore (if they ever did)
- Fixed an issue with
insert
/erase
of meta sequence containers - Re-added
meta_type::remove_pointer
-
signal
:- Added more comparison operators for resource handles
Any other business
The documentation is up-to-date and the library is battle-tested with 100% coverage as usual.
EnTT v3.10.0
Changelog
-
config
:- Added the
macro.h
file with a couple of utilities - Export the
ENTT_VERSION
string - Detect version and configuration mismatches automatically on Windows
- Added the
-
container
:- Uses-allocator construction guaranteed for
dense_set
- Uses-allocator construction guaranteed for
dense_map
dense_map
iterators are in the input iterator category but model either a forward (local) or a random (default) iteratordense_map::value_type
is eitherpair<const T &, U &>
orpair<const T &, const U &>
(zip iterator type)- No more risky UBs due to type punning or destroy/construct within a vector for a
dense_map
- Strong exception guarantee for
emplace
andinsert
functions of thedense_map
class - Strong exception guarantee for
emplace
andinsert
functions of thedense_set
class
- Uses-allocator construction guaranteed for
-
core
:- Store size with hashed strings
- Decouple begin/end iterator types of
iterable_adaptor
- Utility
uses_allocator_construction_args
(waiting for C++20) - Utility
make_obj_using_allocator
(waiting for C++20) - Utility
uninitialized_construct_using_allocator
(waiting for C++20) - Added utilities
allocation_deleter
andallocate_unique
(with uses-allocator construction guaranteed) compressed_pair
correctly manages references with piecewise constructionENTT_NOEXCEPT_IF
(for future uses)- Added an overload of
type_id
to get atype_info
from a variable - Allow to construct
type_info
objects directly (no static storage duration in this case)
-
entity
:- Optimized runtime view iterators
- Weak
basic_registry<...>::storage
for opaque operations across (eventually different) registries basic_runtime_view<...>::iterate/exclude
member functions to attach pools at runtimebasic_sparse_set<...>::emplace
returns an iterator to the inserted element (or the end iterator in case of errors)basic_sparse_set<...>::insert
returns an iterator to the inserted elements (or the end iterator in case of errors)sigh_storage_mixin
always triggers an emplace request notification (in sync with unbalanced destroy)- Chained constructors support (ie parent-to-child propagation) for default storage classes
- Arguments provided to storage classes are always discarded for empty types
- Standalone registry context type returned by the
.ctx()
method, all context functionalities are part of its API now - Support to named context variables (through
emplace_hint
) basic_registry<...>::storage<T>
is no longer[[nodiscard]]
basic_registry<...>::storage<T>
also supports const qualified types- Sparse set's iterators'
::index
returns the right index (that is,offset - 1
) - Internal hook
basic_sparse_set<...>::try_emplace
was changed to return an iterator to the inserted element (orend()
) - Internal hook
basic_sparse_set<...>::try_emplace
was changed to accept an additional booleanforce_back
parameter basic_sparse_set<...>::insert
always appends elements rather than trying to fill tombstones if anybasic_storage<...>::insert
always appends elements rather than trying to fill tombstones if any- Internal hook
basic_sparse_set<...>::swap_and_pop
was changed to accept a couple of iterators - Internal hook
basic_sparse_set<...>::in_place_pop
was canged to accept a couple of iterators basic_sparse_set<...>::clear
no longer creates tombstones (it actually removes all of them)- Automatic traits deduction for the component class, drop
basic_component_traits
- Uses-allocator construction guaranteed for storage classes
- All storage classes support entity and component types with custom swap functions
basic_sparse_set<...>::bump
to force-refresh an entity version- Drop
component_traits::::ignore_if_empty
, use::page_size
0 for empty types - Allow creating pool during a call to
basic_registry<...>::destroy
(ie from a listener) - Added a constructor to reserve enough memory for N pools on creation
-
locator
:- Renamed
service_locator
tolocator
- Allocator support when creating new services (see
allocate_emplace
)
- Renamed
-
meta
:meta_type::invoke
also searches into the base types for a candidate function- Added a compile-time check to prevent attaching a type as a meta base of itself
- Meta sequence containers iterators belong to the input iterator category but model a forward iterator
- Relaxed meta sequence containers requirements
- Dereferencing a pointer-like object that converts to bool works in all cases (false implies empty
meta_any
)
-
process
:- Allow attaching tasks to a
scheduler
from already running processes
- Allow attaching tasks to a
-
resource
:- Make resource handles equality comparable
- Removed class
resource_loader
, made the loader a template parameter of theresource_cache
- Full review of the
resource_cache
API and functionalities - Full review of the
resource_handle
(nowresource
) class - Added a transparent
resource_loader
for basic cases
-
signal
:- Renamed
delegate::instance
todelegate::data
- Added support for named queues to the
basic_dispatcher
class - Enable fetching the number of pending events from a
basic_dispatcher
- Allocator support for the
basic_dispatcher
class
- Renamed
-
Performance improvements:
- Improved performance for
basic_registry<...>::remove
- Improved performance for
basic_registry<...>::erase
- Blazing fast
basic_sparse_set<...>::clear
- Blazing fast
basic_sparse_set<...>::erase
when usingbasic_sparse_set<...>::[const_]iterator
s
- Improved performance for
-
Build system:
- Removed the in-source build check
Natvis support
- Added info about the sparse array of a sparse set (non-null elements only)
- Updated representation for hashed strings (also include size)
- Updated representation for the registry context
- Updated representation for dense map and dense set
- Updated representation for all classes in the resource module
Breaking changes
-
container
:dense_hash_map
was renamed todense_map
dense_hash_set
was renamed todense_set
-
core
:- Removed
is_iterator_type[_v]
, no alternative provided - Removed
ENTT_LAUNDER
- Removed
-
entity
:basic_runtime_view
s do not have a vector-based constructor anymore, use::iterate
and::exclude
insteadbasic_registry<...>::runtime_view
no longer exists, use the default constructor, then::iterate
and::exclude
- Registry context functionalities have been moved to the standalone registry context class and are now part of its API
basic_sparse_set<...>::slot
is no longer available, no alternative providedbasic_sparse_set<...>
hooks were slightly changed for performance reasonsbasic_component_traits
doesn't exist anymore, all values should be specified explicitly- Renamed
basic_registry<...>::sortable
tobasic_registry<...>::owned
component_traits::::ignore_if_empty
isn't available anymore, set thepage_size
to 0 to avoid creating empty types
-
locator
:- Renamed
service_locator
tolocator
- Full review of the
locator
's API (all functions are still there but they've likely a different name)
- Renamed
-
resource
:- Removed class
resource_loader
, made the loader a template parameter of theresource_cache
- Full review of the
resource_cache
API and functionalities - Full review of the
resource_handle
(nowresource
) class
- Removed class
-
signal
:delegate::instance
doesn't exist anymore, usedelegate::data
instead
Any other business
The documentation is up-to-date and the library is battle-tested with 100% coverage as usual.
I started a long term process to reduce the number of instantiations and also speed up the compilation.
This release contains many changes and great improvements in this regard. Still a work in progress though.
EnTT v3.9.0
Changelog
-
container
:- Introduced a new
dense_hash_map
class that is mostly a drop-in replacement forstd::unordered_map
. - Introduced a new
dense_hash_set
class that is mostly a drop-in replacement forstd::unordered_set
.
- Introduced a new
-
core
:- Added
type_info
constructor with in-place type (as instd::in_place_type_t<T>
). - Added the new class
compressed_pair
for internal uses but also available to the final user (with support to structured binding). - Added
is_ebco_eligible[_v]
utility. any_cast
no longer forces by-copy construction for rvalues.- Added enum-as-bitmask support for enum classes.
- Created a new
memory.hpp
header to support/offer general purpose functions generally missed in the standard library. - Added
to_address
to unwrap fancy pointers, waiting for C++20. - Added
propagate_on_container_copy_assignment
,propagate_on_container_move_assignment
andpropagate_on_container_swap
. - Constexpr function
is_power_of_two
, it's mainly meant for internal uses but also generally available. - Constexpr function
fast_mod
, it's mainly meant for internal uses but also generally available. - Created a new
tuple.hpp
header to support/offer general purpose functions generally missed in the standard library. - Utility
unwrap_tuple
, it's mainly meant for internal uses but also generally available. constexpr
support fortype_info
.basic_any<...>::type
returns the object type if any,type_id<void>()
(and not an emptytype_info
) otherwise.- Added optional
const type_info &
parameter (requested type) tobasic_any<...>::data
. operator<
,operator<=
,operator>
andoperator>=
forbasic_hashed_string
.operator<
,operator<=
,operator>
andoperator>=
fortype_info
.type_id
returnstype_info
objects with static storage duration.- Added
basic_any<...>::assign
to copy or move assign the wrapped value without replacing it. - Added
to_entity
andto_version
asideto_integral
, they forward the request to the rightentt_traits<...>
class. - New
input_iterator_pointer
utility class. - Constexpr function
next_power_of_two
, it's mainly meant for internal uses but also generally available. - Added
is_transparent[_v]
utility class. - An
is_transparent
type member is now part of theidentity
class. iterable_adaptor
utility to create a temporary iterable object from two iterators.
- Added
-
entity
:- Added
in_place_delete[_v]
andignore_as_empty[_v]
utilities. basic_sparse_set<...>
is a non-copyable allocator-aware container (::get_allocator()
, pocma/pocca/pocs support, and so on).basic_storage<...>
is a non-copyable allocator-aware container (::get_allocator()
, pocma/pocca/pocs support, and so on).- Empty allocators are elided by exploiting EBCO.
- All storage classes offer a
get_as_tuple
function. - Added
owned_t
besidesget_t
andexclude_t
. - Included destroyed list head in the entity count when creating a snapshot.
entt_traits
is now a first class citizen of the library and all entity related requests rely on it (see::combine
and so on).basic_registry<...>::current
returns a tombstone version for invalid entities and doesn't assert anymore.- Added
basic_sparse_set<...>::current
to return known version of identifiers in set. - Sparse arrays also contain updated entity versions, no more unused bits (out-of-sync support).
- Sparse sets manage correctly foreign entities in all cases, the version is always taken in consideration now.
- No tombstone checks for multi-type views, zero-cost pointer stability model.
- Added empty
::get
method to storage for empty types. - In-place delete always fills holes before appending new elements during an
::insert
. - Generalized
::insert
for all mixins. - Storage types are safe to use from the base class in all cases, no more risky corner cases.
- Decoupled sparse set iterators from allocators to reduce instantiations.
- Decoupled storage iterators from allocators to reduce instantiations.
- Added
basic_view<...>::operator[]
overload to access (eventually unwrapped) components by entity. operator->
for iterable objects iterators (iterable view, iterable group).- Added
basic_view<...>::handle
to return a const reference to the leading storage. - Non-const to const conversion guaranteed for storage iterators.
- Include
fwd.hpp
fromentity.hpp
to makeentity
available in all cases. - Make
basic_registry<...>::all_of
,basic_registry<...>::any_of
and a few other functions remove const qualifiers. - Make
is_iterator[_v]
also supportvoid *
andconst void *
. - Tuple-like type support for
is_equality_comparable[_v]
. - Support for views with multiple components of the same type (i.e.
view<E, T, T, T>
). - Added
basic_view<...>::use<integral value>()
to set leading pool by index. - Added
basic_view<...>::get<integral value>(e)
to get components by index. - Make the
basic_registry
class work smoothly across boundaries. - Use a dense hash map to store context variables.
- Removed the
void *
custom argument frombasic_sparse_set::remove
,::erase
,::emplace
,::insert
,::clear
. - Added a
bind
function to thebasic_sparse_set
to pass the outer context to mixins. - Fully removed the poly storage support.
- Make a const
basic_registry
fully thread-safe (with placeholder pools). swap
is not longer virtual in thebasic_sparse_set
.- Allow emplacing opaque values (
void *
) from abasic_sparse_set
. - Allow getting the value type of the derived class from a
basic_sparse_set
with::type
, if any. - Allow getting the value associated to an entity from a derived class as an opaque pointer (
void *
) with::get
, if any. - Removed
basic_registry::prepare
. - Added
basic_registry::storage<T>
to get or create pools at runtime and bind them to a custom name if needed. - Make
to_entity
also work with stable types. - Turned
basic_component_traits::in_place_delete
into a boolean value. - Turned
basic_component_traits::ignore_if_empty
into a boolean value. - Added
basic_component_traits::page_size
to allow customizing the packed page size on a per-type basis. - Removed
in_place_delete_v
. - Added
basic_view::storage<T>
to get pools at runtime if needed. - Added
basic_group::storage<T>
to get pools at runtime if needed. - Added
entt_traits::page_size
to allow customizing the sparse page size on a per-type basis. - Added
basic_group<...>::handle
to return a const reference to the leading storage. - Multi-type views' iterators are in the forward iterator category now.
- Iterable views (
.each()
) do not offer reverse iterators anymore (cannot implement them correctly). - Iterable groups (
.each()
) do not offer reverse iterators anymore (cannot implement them correctly). - Added
basic_sparse_set<...>::cbegin
/::cend
/crbegin
/crend
and theconst_iterator
andconst_reverse_iterator
type members. basic_storage<...>::each
function to iterate a storage as a set of entity/component tuples.- Views and groups iterators are also default constructible and a default constructed iterator always compares to
end
. - Added
basic_registry<...>::storage()
to return pools and their names as an iterable object.
- Added
-
meta
:meta_type::construct
doesn't look for base constructors anymore.- Container support review (less instantiations, faster to compile).
- Meta sequence containers
::insert
returns now an iterator that is contextually convertible to bool (for validity checks). - Meta sequence containers
::erase
returns now an iterator that is contextually convertible to bool (for validity checks). meta_arg
utility doesn't require anstd::index_sequence
anymore.- The list of types to
meta_arg
is now a type list template parameter instead of a function parameter. meta_construct
utility doesn't require anstd::index_sequence
anymore.meta_invoke
utility doesn't require anstd::index_sequence
anymore.- A public
meta_dispatch
utility is now available. - Removed
meta_type::is_void
. - Add
fwd.hpp
file for many types in meta. - Non-template version of
meta_any::allow_cast
that works with meta types. - Removed
parent
link from meta objects. - Lambda support for
meta_invoke
andmeta_construct
utilities. - Replaced
meta_type::reset
with themeta_reset
free functions. - Added
cbegin
andcend
tometa_range
. - Added
meta_type::is_arithmetic
to replaceis_integral
andis_floating_point
. - Automatic arithmetic conversion support to mimic what the language offers out of the box.
- Automatic enum conversion support to/from underlying type.
- Multi-setter support for
meta_data
(meta data members). - Added
meta_any::assign
to copy or move assign the wrapped value without replacing it. operator->
for meta containers iterators.operator->
formeta_range
iterators.- Static functions that require the parent type as first argument are treated as (eventually const) member functions.
- Non-const to const conversion guaranteed for
meta_range
iterators. - Extended support to base members when attached to meta types for derived classes.
- Define
meta_associative_container_traits
fordense_hash_map
. - Define
meta_associative_container_traits
fordense_hash_set
. - Member functions can be used as meta destructors.
- Policies also check function return types at compile-time.
- Added
meta_any::owner
to know if ameta_any
also owns the underlying object.
-
poly
:- Single function vtable optimization to avoid indirections.
-
resource
:- Added
resource_handle::use_count
to k...
- Added
EnTT v3.8.1
Changelog
-
core
:- Make
is_equality_comparable[_v]
work with iterators that have a non-comparablevalue_type
.
- Make
-
entity
:- Suppress warning for discarding a
nodiscard
value in the snapshot class. - Removed an inconsistent test that fails sporadically.
- Suppress warning for discarding a
-
meta
:- Avoid a risky fallthrough in the
meta_any
vtable.
- Avoid a risky fallthrough in the
Bug fixes
- Fixed an UB when id type is
std::uint64_t
. - Fixed a sparse set class issue with pages not always properly created during an emplace when in-place deletion policy is enabled.
Build system
Added everything needed to also run tests with id type std::uint64_t on the CI.
Deprecated feature
None.
Breaking changes
None.
Any other business
The documentation is up-to-date and the library is battle-tested with 100% coverage as usual.
EnTT v3.8.0
Changelog
-
config
:- Added error messages to
ENTT_ASSERT
. - Added
ENTT_LAUNDER
to support older compilers that don't offerstd::launder
. - Replaced
ENTT_PAGE_SIZE
withENTT_SPARSE_PAGE
andENTT_PACKED_PAGE
. - Added
ENTT_NOEXCEPTION
to fully suppress support for exceptions. ENTT_NO_EXCEPT
is automatically defined.- Added
ENTT_THROW
,ENTT_TRY
andENTT_CATCH
.
- Added error messages to
-
core
:- Refined aggregate support in
any
to make it closer to its standard counterpart. - Added
make_any
andforward_as_any
functions. - Drastically reduced the number of instantiations/size of vtables due to
any
. - Added
basic_any<...>::owner
to know if the wrapper also owns the contained object. - Added traits
is_iterator[_v]
andis_iterator_type[_v]
.
- Refined aggregate support in
-
entity
:- Storage is always in a valid state upon component removal (component destructors can RW access their own pools).
- Updated
::raw
member function for views and groups to make it opaque (support for fancy pointers from storage). - Updated
basic_sparse_set<E>::remove
to make it work also with entities that aren't part of the set. - Added
basic_sparse_set<E>::erase
that works only with entities that are already in the set. basic_registry<E>::remove<T...>
also accepts entities that don't have the given components (replaces::remove_if_exists
).- Added
basic_registry<E>::erase<T...>
that triggers an error if the entities don't have the given components (it was::remove
). basic_handle<E>::remove<T...>
also accepts types that aren't assigned to the entity (replaces::remove_if_exists
).- Added
basic_handle<E>::erase<T...>
that triggers an error if the entity doesn't have the given components (it was::remove
). - Allocator support for sparse sets and storage classes.
to_entity
returnsentt::null
for invalid components.- Much faster
registry::create
for multiple entities (about twice the performance). basic_registry<E>::insert
andbasic_storage<E, T>::insert
with component array no longer require the end iterator.- Review of
entt_traits
design (added built-in functions::to_entity
,::to_integral
,::to_version
, and so on). - Entity type for class type identifiers is borrowed from
entity_type
member type (specializingentt_traits
is no longer required). - Exception safety for all storage functions is either strong or basic.
- Added the
tombstone_t
type and theentt::tombstone
constexpr variable for tombstone versions. - Updated the registry to skip the tombstone version and overflow to 0 on entity deletion.
- Added
null_t::operator|
to combine the null entity with any identifier (similar totombstone_t::operator|
). - Added
component_traits
(seecomponent.hpp
) to set the ETO policy (ignore_if_empty
) and the deletion policy (in_place_delete
). - Prevented groups from being mixed with tombstone.
- Added support to compact one, more or all pools from the registry API.
- Split
view
s andview_iterator
s, drastically reduced the number of instantiations due to views. - Added stable/packed storage policy support to views (automatic detection of the deletion policy).
- Added
basic_sparse_set<E>::policy
method for opaque runtime detection of the deletion policy. - Added support for storage policy (tombstones) to runtime views (automatic detection of the deletion policy).
- Support for in-place deletion and pointer stability upon deletion on a per-type basis with automatic detection during iterations.
- Support for pointer (and therefore reference) stability when assigning components to entities.
- Registry const
::view
/::group
function also support non-const types. - Added
::release
(aka force-destroy) overloads to the registry class. - Added
::released
function to the registry class to replace::destroyed
. - Fast path on non-view iterators for range
basic_registry<E>::destroy
. - Improved performance on component destruction (it affects multiple functionalities like destroying entities and components).
- Allow storage classes to inhibit component destruction for any reason.
- Added the
basic_sparse_set<E>::slot
function to return the next slot available for insertion. basic_sparse_set<E>::emplace
returns now the slot used for insertion.- Added
basic_sparse_set<E>::emplace_back
function to force back insertion (and skip the tombstone chain check). - Allow non-const types in const overloads of registry context variable getters.
-
meta
:- C-style arrays (eg
T[N]
orT[N][M]
) aren't treated as pointer-like types. - Added
make_meta
andforward_as_meta
functions. - Drastically reduced the number of instantiations/size of vtables due to
meta_any
.
- C-style arrays (eg
-
resource
:- Added a bunch of conversion functions to
resource_handle
.
- Added a bunch of conversion functions to
-
Performance improvements here and there (ie registry
::create
and::destroy
, component destruction/emplace/insert, ...).
Bug fixes
core
:basic_any<...>::operator=(const basic_any<...> &other)
can result in an invalid state whenother
isn't copyable.
Deprecated feature
-
core
:- Deprecated
std::reference_wrapper
support: usestd::in_place_type<T &>
, usemake_any
or::emplace<T &>
instead.
- Deprecated
-
entity
:basic_registry<E>::remove_if_exists
: use::remove
instead (it also supports iterators).basic_handle<E>::remove_if_exists
: use::remove
instead (it also supports iterators).basic_registry<E>::remove_all
: use::destroy(e); ::create(e)
instead.basic_handle<E>::remove_all
: no longer supported.basic_registry<E>::reserve_pools
: no longer supported.basic_registry<E>::destroyed
: use::released
instead.
-
meta
:- Deprecated
std::reference_wrapper
support: usestd::in_place_type<T &>
, usemake_meta
or::emplace<T &>
instead.
- Deprecated
Breaking changes
-
config
:ENTT_ASSERT
now receives two arguments (condition and error message).- Removed
ENTT_PAGE_SIZE
, useENTT_SPARSE_PAGE
andENTT_PACKED_PAGE
instead. - Defining
ENTT_NO_EXCEPT
triggers an error, useENTT_NO_EXCEPTION
to fully disable exceptions instead.
-
core
:- Removed
entt::is_empty[_v]
andENTT_IS_EMPTY
, no longer required/supported.
- Removed
-
entity
view::raw
andgroup::raw
return now a paged array of components (for pointer stability).basic_registry<E>::insert
andbasic_storage<E, T>::insert
no longer require the end iterator.- No longer required to specialize
entt_traits
. Otherwise, provide member function::to_entity
,::to_version
, and so on. - Removed
about_to_pop
virtual function from the sparse set class.
-
poly
:- Removed
std::reference_wrapper
support (reference in-place construction still available).
- Removed
-
process
:process::dead
has been renamed toprocess::finished
.
Any other business
The documentation is up-to-date and the library is battle-tested with 100% coverage as usual.
I started a long term process to reduce the number of instantiations and also speed up the compilation.
This release contains many changes and great improvements in this regard. Still a work in progress though.
EnTT v3.7.1
Changelog
-
core
:- Extended support to both aggregates and non-aggregates type for
any
. - No more redundant copies in
any
when emplacing (as in.emplace<T>(args...)
). - No more redundant copies in
any
when emplacing (as in= value
). - No more redundant copies in
any
when resetting (as in.reset()
).
- Extended support to both aggregates and non-aggregates type for
-
entity
:- Updated iterable views (
view.each()
) to make them work with<algorithm>
in all cases. - Updated iterable groups (
group.each()
) to make them work with<algorithm>
in all cases.
- Updated iterable views (
-
meta
:- Extended support to both aggregates and non-aggregates type for
meta_any
. - No more redundant copies in
meta_any
when emplacing (as in.emplace<T>(args...)
). - No more redundant copies in
meta_any
when emplacing (as in= value
). - No more redundant copies in
meta_any
when resetting (as in.reset()
). - Reduced instantiations due to
meta_prop
.
- Extended support to both aggregates and non-aggregates type for
Bug fixes
None
Breaking changes
core
:- Removed trait
is_std_hashable[_v]
.
- Removed trait
Any other business
The documentation is up-to-date and the library is battle-tested with 100% coverage as usual.
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.
EnTT v3.7.0
Changelog
core
:- Added support for non-copyable types to
any
. - Standard containers friendly
is_equality_comparable
trait. - Added
type_list_diff[_t]
trait. - Added
any::reset()
. - Copying an
any
always returns a copy of the contained object, even in case of references to external elements. - Added
is_std_hashable[_v]
trait. type_id<T>()
is a[[nodiscard]]
function now.any::as_ref
is a member function rather than an in-class friend function exported in the global namespace.basic_any
supports configurable sbo size,any
is an alias forbasic_any<sizeof(double[2])>
.- Added eventually constexpr conversion operator to underlying type to
type_seq
. - Added eventually constexpr conversion operator to underlying type to
type_hash
. - Added eventually constexpr conversion operator to underlying type to
type_name
. basic_any
takes now in consideration implicit alignment requirements for in_situ tests.- Added an extra parameter to
basic_any
to specify desired alignment requirements for the SBO storage.
- Added support for non-copyable types to
entity
:- Avoid UB with
sparse_set::clear
and component-lessregistry::clear
. - Use
entt::any
to store context variables in a registry. registry::storage
returns actual references (eventually const) to the poly storage objects.- Added
basic_sparse_set<E>::at
to get entities at given positions. - Stable virtual
remove
for sparse sets. - Poly storage no longer has a
remove
member function by default. - Faster
registry::clear
that delegates to pools. - Added optional user data to
basic_sparse_set<E>::remove
andbasic_sparse_set<E>::clear
. - Simplified
sigh_storage_mixin
, less instantiations, less code, same functionalities. - Added unchecked
basic_sparse_set<E>::operator[](pos)
. - Added support to aliased context variables (externally managed objects attached to a registry by reference).
- Added an
operator|
to views for piping that creates a new view rather than a view pack. - Non-allocating non-const
registry::try_get
.
- Avoid UB with
meta
:- Implicitly generated default meta constructors for default constructible types.
- Pointer-like to
void
support (dereference to invalidmeta_any
). - All overloads of
meta_type::base
return instances ofmeta_type
now. - User defined getters are detected as are data members (
is_invocable<F, [const] T &>
instead ofis_invocable<F, [const] T *>
). as_ref_t
adapts to the constness of the underlying object/return type,as_cref_t
always returns by const reference.- Added
meta_any::reset()
. - Internal utilities (like
meta_function_descriptor
andmeta_invoke
) are now public for use as needed. - Support for
std::vector<bool>
and the like as meta containers. - Added support for self-pointers and proxy pointers to
meta_any
when used as pointer-like types. - Added explicit const
meta_handle::operator bool()
. - Copying a
meta_any
always returns a copy of the contained object, even in case of references to external elements. - Added minimal customizable class template detection support to
meta_type
(see for exampleis_template_specialization
). meta_any::operator==
is now consistent across boundaries.meta_any::as_ref
is a member function rather than an in-class friend function exported in the global namespace.- Re-registering meta objects is safe in all cases unless the meta objects has a name and the id is already used by a different element (hard user error).
- A
meta_prop
key is now returned by const reference rather than by copy. - Removed
has_meta_sequence_container_traits[_v]
andhas_meta_associative_container_traits[_v]
. - Meta destructors are no longer invoked for non-owning
meta_any
objects.
resource
:- Removed the requirement for
shared_ptr<T>
from the loader/cache.
- Removed the requirement for
poly
:- Added
poly::reset()
. - Copying a
poly
always returns a copy of the contained object, even in case of references to external elements. poly<T>::as_ref
is a member function rather than an in-class friend function exported in the global namespace.poly
supports configurable sbo size with a default ofsizeof(double[2])
.- Added an extra parameter to
poly
to specify desired alignment requirements for the underlying storage.
- Added
signal
:- Made
dispatcher
class work fine withstd::is_copy_constructible
.
- Made
- Build system:
- Updated
Bazel
configuration. - Added
pkg-config
support upon installation. - Use
lcov
for code coverage on the CI.
- Updated
Bug fixes
entity
:- Fixed an issue with
registry::clear
. There are two ways to get around it in v3.6.x:registry.each([&](auto entity) { registry.destroy(entity); });
if interested in signals.registry = {};
if not interested in signals.
- Fixed an issue with
Breaking changes
core
:- In-place construction of references in
any
requires the argument to be an actual lvalue reference and not a pointer. - Copying an
any
always returns a copy of the contained object, even in case of references to external elements. Move theany
object, pass it by reference or useas_ref
to propagate elements without copying them. - Free function
as_ref
no longer exists forany
, useany::as_ref()
instead. ENTT_PAGE_SIZE
sets the number of elements of a page, not the size in bytes.
- In-place construction of references in
entity
:- Removed
registry::raw<T>()
, useregistry.view<T>().raw()
instead. - Removed
registry::data<T>()
, useregistry.view<T>().data()
instead. - Updated precondition of
registry::assign
(all pools empty -> no entities still alive). - Renamed
registry::has<T...>
toregistry::all_of<T...>
andregistry::any<T...>
toregistry::any_of<T...>
. - Renamed
handle::has<T...>
tohandle::all_of<T...>
andhandle::any<T...>
tohandle::any_of<T...>
. registry::storage
returns poly storage objects by reference rather than by copy. Capture them by reference before using.- Poly storage no longer has a
remove
member function by default. - Const
registry::view
is no longer thread safe.
- Removed
meta
:- Removed
meta_conv
, it's used internally when needed (egmeta_any::allow_cast
). - Removed
meta_base
, it's used internally when needed (egmeta_any::cast
). - All overloads of
meta_type::base
return instances ofmeta_type
now. - Meta iterators for associative containers return keys as const references and no longer by copy.
meta_handle::operator*
isn't available anymore, no alternatives provided.- Copying a
meta_any
always returns a copy of the contained object, even in case of references to external elements. Move themeta_any
object, pass it by reference or useas_ref
to propagate elements without copying them. - Renamed
meta_ctor::size
andmeta_func::size
tometa_ctor::arity
andmeta_func::arity
. - Deleted
meta_handle
copy constructor. No alternatives provided. Meta handles should never be copied. - Free function
as_ref
no longer exists formeta_any
, usemeta_any::as_ref()
instead. - Removed
has_meta_sequence_container_traits[_v]
, useentt::is_complete_v<entt::meta_sequence_container_traits<T>>
instead. - Removed
has_meta_associative_container_traits[_v]
, useentt::is_complete_v<entt::meta_sequence_associative_traits<T>>
instead.
- Removed
poly
:- Copying a
poly
always returns a copy of the contained object, even in case of references to external elements. Move thepoly
object, pass it by reference or useas_ref
to propagate elements without copying them. - Free function
as_ref
no longer exists forpoly<T>
, usepoly<T>::as_ref()
instead.
- Copying a
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 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.
EnTT v3.6.0
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]
.
...
EnTT v3.5.2
Changelog:
meta
:- Implemented shortcuts for meta-functions and meta-data (see
meta_any
andmeta_type
). meta_any
support for pointer-like types to non-const, non-copyable types.
- Implemented shortcuts for meta-functions and meta-data (see
The documentation is up-to-date and the library is battle-tested with 100% coverage as usual.
I've also updated the section EnTT
in Action with more and more examples.