Skip to content

EnTT v3.9.0

Compare
Choose a tag to compare
@skypjack skypjack released this 21 Dec 12:24
· 2616 commits to master since this release

Changelog

  • container:

    • Introduced a new dense_hash_map class that is mostly a drop-in replacement for std::unordered_map.
    • Introduced a new dense_hash_set class that is mostly a drop-in replacement for std::unordered_set.
  • core:

    • Added type_info constructor with in-place type (as in std::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 and propagate_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 for type_info.
    • basic_any<...>::type returns the object type if any, type_id<void>() (and not an empty type_info) otherwise.
    • Added optional const type_info & parameter (requested type) to basic_any<...>::data.
    • operator<, operator<=, operator> and operator>= for basic_hashed_string.
    • operator<, operator<=, operator> and operator>= for type_info.
    • type_id returns type_info objects with static storage duration.
    • Added basic_any<...>::assign to copy or move assign the wrapped value without replacing it.
    • Added to_entity and to_version aside to_integral, they forward the request to the right entt_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 the identity class.
    • iterable_adaptor utility to create a temporary iterable object from two iterators.
  • entity:

    • Added in_place_delete[_v] and ignore_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 besides get_t and exclude_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 from entity.hpp to make entity 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 support void *and const 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 from basic_sparse_set::remove, ::erase, ::emplace, ::insert, ::clear.
    • Added a bind function to the basic_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 the basic_sparse_set.
    • Allow emplacing opaque values (void *) from a basic_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 the const_iterator and const_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.
  • 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 an std::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 an std::index_sequence anymore.
    • meta_invoke utility doesn't require an std::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 and meta_construct utilities.
    • Replaced meta_type::reset with the meta_reset free functions.
    • Added cbegin and cend to meta_range.
    • Added meta_type::is_arithmetic to replace is_integral and is_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-> for meta_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 for dense_hash_map.
    • Define meta_associative_container_traits for dense_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 a meta_any also owns the underlying object.
  • poly:

    • Single function vtable optimization to avoid indirections.
  • resource:

    • Added resource_handle::use_count to know how many handles are there for a single resource.
    • Added resource_handle::resource_type type 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.
  • signal:

    • scoped_connection is now move assignable and move constructible.
    • Make the dispatcher class work smoothly across boundaries.
    • Make the emitter class work smoothly across boundaries.
    • Allocator support for the sigh class.
  • Performance improvements here and there (ie storage classes, any and any_cast, ...).

  • clang-format support. 🥳

Build system

  • Added a pipeline to ensure that EnTT works as expected with all major compilers when using C++20.
  • ENTT_USE_LIBCPP default is OFF.
  • ENTT_INCLUDE_HEADERS option to add headers to the EnTT target (default: OFF).
  • ENTT_INCLUDE_NATVIS option 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_info
  • entt::basic_any
  • entt::compressed_pair
  • entt::dense_hash_map
  • entt::dense_hash_set
  • entt::meta_any
  • entt::meta_associative_container
  • entt::internal::meta_base_node
  • entt::internal::meta_conv_node
  • entt::internal::meta_ctor_node
  • entt::internal::meta_data_node
  • entt::meta_data
  • entt::internal::meta_func_node
  • entt::meta_func
  • entt::meta_handle
  • entt::internal::meta_prop_node
  • entt::meta_prop
  • entt::meta_sequence_container
  • entt::internal::meta_template_node
  • entt::internal::meta_type_node
  • entt::meta_type
  • entt::basic_hashed_string
  • entt::delegate
  • entt::sigh
  • entt::sink
  • entt::connection
  • entt::scoped_connection
  • entt::basic_view
  • entt::tombstone
  • entt::null
  • entt::basic_registry
  • entt::poly
  • entt::dispatcher
  • entt::basic_view

Breaking changes

  • core:

    • Renamed type_seq to type_index.
    • Renamed type_info::seq to type_info::index.
    • type_info is no longer default nor user constructible, use type_id instead.
    • Renamed unpack_as_t to unpack_as_type and unpack_as_v to unpack_as_value.
  • entity:

    • Removed basic_storage<...>::sort, capture pool and use ::get if needed.
    • Removed basic_storage<...>::sort_n, capture pool and use ::get if 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 therefore view<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|, use entt_traits<...>::combine instead.
    • Removed tombstone_t::operator|, use entt_traits<...>::combine instead.
    • Removed basic_registry<...>::version, use entt_traits instead.
    • Removed basic_registry<...>::entity, use entt_traits instead.
    • basic_sparse_set<...>::clear honors the set modality.
    • Renamed basic_sparse_set<...>::swap for entities to swap_elements to avoid conflicts.
    • Removed basic_sparse_set<...>::emplace_back, no alternative provided.
    • basic_sparse_set<...>::emplace doesn't return the position anymore.
    • entt_traits<...> doesn't offer anymore a difference_type alias.
    • Removed support for view.each<T>(F), use view.use<T>().each(F) instead.
    • Removed support for view.each<T>(), use view.use<T>().each() instead.
    • Removed basic_registry::prepare<T>, use storage<T> instead.
    • Removed in_place_delete_v<T>, use component_traits<T>::in_place_delete instead.
    • Removed basic_registry<...>::reserve<T>, use basic_registry<...>::storage<T>().reserve(N) instead.
    • Removed basic_registry<...>::capacity<T>, use basic_registry<...>::storage<T>().capacity() instead.
    • Removed basic_registry<...>::shrink_to_fit<T>, use basic_registry<...>::storage<T>().shrink_to_fit() instead.
    • Removed basic_registry<...>::size<T>, use basic_registry<...>::storage<T>().size() or a single type view instead.
    • Removed basic_registry<...>::empty<T>, use basic_registry<...>::storage<T>().empty() or a single type view instead.
    • Removed basic_view<...>::raw for single type views, use basic_view<...>::storage().raw() instead.
    • Removed basic_view<...>::data for single type views, use basic_view<...>::storage().data() instead.
    • Removed basic_group<...>::raw<T>, use basic_group<...>::storage<T>().raw() instead.
    • Removed basic_group<...>::data<T>, use basic_group<...>::handle().data() instead.
    • Removed basic_registry<...>::orphans, combine each and orphan instead.
    • Removed basic_registry<...>::visit(e, F), use the new iterable object to iterate pools instead.
    • Removed basic_registry<...>::visit, use basic_registry<...>::storage() instead.
  • meta:

    • Meta sequence containers ::insert no longer returns also a bool value but the iterator is contextually convertible to bool now.
    • Meta sequence containers ::erase no longer returns also a bool value but the iterator is contextually convertible to bool now.
    • meta_arg requires to pass the list of arguments as a type list template parameter instead of as a function argument.
    • Removed meta_type::is_void, use type == resolve<void>() instead.
    • Removed parent link from meta objects, no alternative provided.
    • Removed meta_type::reset, use the meta_reset functions 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, use meta_type::is_arithmetic instead.
    • Removed meta_type::is_floating_point, use meta_type::is_arithmetic instead.
    • 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<...>::prop multiple times, use ::props instead.
    • Removed annotation support for meta properties, no alternative provided.
    • Removed meta_ctor and all meta_type::ctor overloads, no alternatives provided.

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.