EnTT v3.9.0
Changelog
-
container:- Introduced a new
dense_hash_mapclass that is mostly a drop-in replacement forstd::unordered_map. - Introduced a new
dense_hash_setclass that is mostly a drop-in replacement forstd::unordered_set.
- Introduced a new
-
core:- Added
type_infoconstructor with in-place type (as instd::in_place_type_t<T>). - Added the new class
compressed_pairfor internal uses but also available to the final user (with support to structured binding). - Added
is_ebco_eligible[_v]utility. any_castno longer forces by-copy construction for rvalues.- Added enum-as-bitmask support for enum classes.
- Created a new
memory.hppheader to support/offer general purpose functions generally missed in the standard library. - Added
to_addressto unwrap fancy pointers, waiting for C++20. - Added
propagate_on_container_copy_assignment,propagate_on_container_move_assignmentandpropagate_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.hppheader 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. constexprsupport fortype_info.basic_any<...>::typereturns the object type if any,type_id<void>()(and not an emptytype_info) otherwise.- Added optional
const type_info ¶meter (requested type) tobasic_any<...>::data. operator<,operator<=,operator>andoperator>=forbasic_hashed_string.operator<,operator<=,operator>andoperator>=fortype_info.type_idreturnstype_infoobjects with static storage duration.- Added
basic_any<...>::assignto copy or move assign the wrapped value without replacing it. - Added
to_entityandto_versionasideto_integral, they forward the request to the rightentt_traits<...>class. - New
input_iterator_pointerutility 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_transparenttype member is now part of theidentityclass. iterable_adaptorutility 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_tuplefunction. - Added
owned_tbesidesget_tandexclude_t. - Included destroyed list head in the entity count when creating a snapshot.
entt_traitsis now a first class citizen of the library and all entity related requests rely on it (see::combineand so on).basic_registry<...>::currentreturns a tombstone version for invalid entities and doesn't assert anymore.- Added
basic_sparse_set<...>::currentto 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
::getmethod to storage for empty types. - In-place delete always fills holes before appending new elements during an
::insert. - Generalized
::insertfor 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<...>::handleto return a const reference to the leading storage. - Non-const to const conversion guaranteed for storage iterators.
- Include
fwd.hppfromentity.hppto makeentityavailable in all cases. - Make
basic_registry<...>::all_of,basic_registry<...>::any_ofand 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_registryclass 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
bindfunction to thebasic_sparse_setto pass the outer context to mixins. - Fully removed the poly storage support.
- Make a const
basic_registryfully thread-safe (with placeholder pools). swapis 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_setwith::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_entityalso work with stable types. - Turned
basic_component_traits::in_place_deleteinto a boolean value. - Turned
basic_component_traits::ignore_if_emptyinto a boolean value. - Added
basic_component_traits::page_sizeto 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_sizeto allow customizing the sparse page size on a per-type basis. - Added
basic_group<...>::handleto 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/crendand theconst_iteratorandconst_reverse_iteratortype members. basic_storage<...>::eachfunction 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::constructdoesn't look for base constructors anymore.- Container support review (less instantiations, faster to compile).
- Meta sequence containers
::insertreturns now an iterator that is contextually convertible to bool (for validity checks). - Meta sequence containers
::erasereturns now an iterator that is contextually convertible to bool (for validity checks). meta_argutility doesn't require anstd::index_sequenceanymore.- The list of types to
meta_argis now a type list template parameter instead of a function parameter. meta_constructutility doesn't require anstd::index_sequenceanymore.meta_invokeutility doesn't require anstd::index_sequenceanymore.- A public
meta_dispatchutility is now available. - Removed
meta_type::is_void. - Add
fwd.hppfile for many types in meta. - Non-template version of
meta_any::allow_castthat works with meta types. - Removed
parentlink from meta objects. - Lambda support for
meta_invokeandmeta_constructutilities. - Replaced
meta_type::resetwith themeta_resetfree functions. - Added
cbeginandcendtometa_range. - Added
meta_type::is_arithmeticto replaceis_integralandis_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::assignto copy or move assign the wrapped value without replacing it. operator->for meta containers iterators.operator->formeta_rangeiterators.- 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_rangeiterators. - Extended support to base members when attached to meta types for derived classes.
- Define
meta_associative_container_traitsfordense_hash_map. - Define
meta_associative_container_traitsfordense_hash_set. - Member functions can be used as meta destructors.
- Policies also check function return types at compile-time.
- Added
meta_any::ownerto know if ameta_anyalso owns the underlying object.
-
poly:- Single function vtable optimization to avoid indirections.
-
resource:- Added
resource_handle::use_countto know how many handles are there for a single resource. - Added
resource_handle::resource_typetype member. - Review of the resource handle to make it a value type and improve the const correctness of the class.
- Review of the resource cache to improve the const correctness of the class.
- Added aliasing constructor to resource handle.
- Added
-
signal:scoped_connectionis now move assignable and move constructible.- Make the
dispatcherclass work smoothly across boundaries. - Make the
emitterclass work smoothly across boundaries. - Allocator support for the
sighclass.
-
Performance improvements here and there (ie storage classes,
anyandany_cast, ...). -
clang-formatsupport. 🥳
Build system
- Added a pipeline to ensure that
EnTTworks as expected with all major compilers when using C++20. ENTT_USE_LIBCPPdefault isOFF.ENTT_INCLUDE_HEADERSoption to add headers to the EnTT target (default:OFF).ENTT_INCLUDE_NATVISoption to add natvis files to the EnTT target (default:OFF).
EnTT across boundaries
This is all you need to do right now for EnTT to work across boundaries:
That is, absolutely nothing. Things like the registry class don't make use of static variables anymore and therefore they don't risk to break when used across boundaries. They should just work out of the box. Finally. 🙂
Natvis files
List of classes already covered by natvis files upstream (work in progress):
entt::basic_sparse_set(with tombstones detection)entt::basic_storage(with tombstones detection)entt::type_infoentt::basic_anyentt::compressed_pairentt::dense_hash_mapentt::dense_hash_setentt::meta_anyentt::meta_associative_containerentt::internal::meta_base_nodeentt::internal::meta_conv_nodeentt::internal::meta_ctor_nodeentt::internal::meta_data_nodeentt::meta_dataentt::internal::meta_func_nodeentt::meta_funcentt::meta_handleentt::internal::meta_prop_nodeentt::meta_propentt::meta_sequence_containerentt::internal::meta_template_nodeentt::internal::meta_type_nodeentt::meta_typeentt::basic_hashed_stringentt::delegateentt::sighentt::sinkentt::connectionentt::scoped_connectionentt::basic_viewentt::tombstoneentt::nullentt::basic_registryentt::polyentt::dispatcherentt::basic_view
Breaking changes
-
core:- Renamed
type_seqtotype_index. - Renamed
type_info::seqtotype_info::index. type_infois no longer default nor user constructible, usetype_idinstead.- Renamed
unpack_as_ttounpack_as_typeandunpack_as_vtounpack_as_value.
- Renamed
-
entity:- Removed
basic_storage<...>::sort, capture pool and use::getif needed. - Removed
basic_storage<...>::sort_n, capture pool and use::getif needed. - Removed the free function
get_as_tuple, use the functions offered by storage classes instead. - Changed view definition to
basic_view<T, get_t<C...>, exclude_t<E...>>and thereforeview<get_t<C...>, exclude_t<E...>>(second parameter is optional). - Changed group definition to
basic_group<T, owned_t<O...>, get_t<G...>, exclude_t<E...>>. basic_view<...>::use<T>doesn't modify the view in-place anymore, instead it returns a new view.- Removed
null_t::operator|, useentt_traits<...>::combineinstead. - Removed
tombstone_t::operator|, useentt_traits<...>::combineinstead. - Removed
basic_registry<...>::version, useentt_traitsinstead. - Removed
basic_registry<...>::entity, useentt_traitsinstead. basic_sparse_set<...>::clearhonors the set modality.- Renamed
basic_sparse_set<...>::swapfor entities toswap_elementsto avoid conflicts. - Removed
basic_sparse_set<...>::emplace_back, no alternative provided. basic_sparse_set<...>::emplacedoesn't return the position anymore.entt_traits<...>doesn't offer anymore adifference_typealias.- Removed support for
view.each<T>(F), useview.use<T>().each(F)instead. - Removed support for
view.each<T>(), useview.use<T>().each()instead. - Removed
basic_registry::prepare<T>, usestorage<T>instead. - Removed
in_place_delete_v<T>, usecomponent_traits<T>::in_place_deleteinstead. - Removed
basic_registry<...>::reserve<T>, usebasic_registry<...>::storage<T>().reserve(N)instead. - Removed
basic_registry<...>::capacity<T>, usebasic_registry<...>::storage<T>().capacity()instead. - Removed
basic_registry<...>::shrink_to_fit<T>, usebasic_registry<...>::storage<T>().shrink_to_fit()instead. - Removed
basic_registry<...>::size<T>, usebasic_registry<...>::storage<T>().size()or a single type view instead. - Removed
basic_registry<...>::empty<T>, usebasic_registry<...>::storage<T>().empty()or a single type view instead. - Removed
basic_view<...>::rawfor single type views, usebasic_view<...>::storage().raw()instead. - Removed
basic_view<...>::datafor single type views, usebasic_view<...>::storage().data()instead. - Removed
basic_group<...>::raw<T>, usebasic_group<...>::storage<T>().raw()instead. - Removed
basic_group<...>::data<T>, usebasic_group<...>::handle().data()instead. - Removed
basic_registry<...>::orphans, combineeachandorphaninstead. - Removed
basic_registry<...>::visit(e, F), use the new iterable object to iterate pools instead. - Removed
basic_registry<...>::visit, usebasic_registry<...>::storage()instead.
- Removed
-
meta:- Meta sequence containers
::insertno longer returns also a bool value but the iterator is contextually convertible to bool now. - Meta sequence containers
::eraseno longer returns also a bool value but the iterator is contextually convertible to bool now. meta_argrequires to pass the list of arguments as a type list template parameter instead of as a function argument.- Removed
meta_type::is_void, usetype == resolve<void>()instead. - Removed
parentlink from meta objects, no alternative provided. - Removed
meta_type::reset, use themeta_resetfunctions instead. - Removed
meta_type::rank, no alternative provided. - Removed
meta_type::extent, no alternative provided. - Removed
meta_type::remove_extent, no alternative provided. - Removed
meta_type::remove_pointer, use((*any).type())instead. - Removed
meta_type::is_function_pointer, no alternative provided. - Removed
meta_type::is_union, no alternative provided. - Removed
meta_type::is_integral, usemeta_type::is_arithmeticinstead. - Removed
meta_type::is_floating_point, usemeta_type::is_arithmeticinstead. - Meta default constructors are no longer returned from a direct lookup nor during iterations.
- Removed
meta_type::is_member_object_pointer, no alternative provided. - Removed
meta_type::is_member_function_pointer, no alternative provided. - Removed the possibility of invoking
meta_factory<...>::propmultiple times, use::propsinstead. - Removed annotation support for meta properties, no alternative provided.
- Removed
meta_ctorand allmeta_type::ctoroverloads, no alternatives provided.
- Meta sequence containers
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.