github skypjack/entt v3.6.0
EnTT v3.6.0

latest releases: v3.15.0, v3.14.0, v3.13.2...
4 years ago

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 new any 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 and type_info is now an opaque type returnd by type_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.
  • 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 class type_info<T>.
    • Added type_id function template to generate untyped type_info objects from types:
      auto info = entt::type_id<a_type>();
      
    • Added utility type_list_contains[_v].
    • Added size_of_v, an extension for sizeof 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 to type_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] and is_applicable_r[_v], a sort of std::is_invocable with tuples.
    • Added trait is_empty[_v] (mainly used for internal purposes) that is true only if ENTT_NO_ETO isn't defined.
    • Updated default page size (ENTT_PAGE_SIZE) to 4096.
    • hashed_string::value is now constexpr, 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 namespace entt::literals.
    • Added trait is_complete[_v] to detect complete types.
    • Standalone, branchless implementation of entt::any with a default SBO size of sizeof(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 with any.
    • Added value_list and value_list_cat[_t] (similar to type_list and type_list_cast[_t], but for values rather than types).
    • Added type_identity[_t] trait (waiting for a C++20 version of EnTT).
    • Added type_list_element[_t] for type_lists, similar to std::tuple_element_t.
    • Added value_list_element[_v] for value_lists, similar to std::tuple_element_t.
  • entity:

    • Full support for custom storage/views (🥳). This is HUGE, even if at the moment it lacks proper documentation.
    • storage_adapter_mixin and sigh_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 and registry::ctx return now a whole type_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 for object_type (storage, pool).
    • Added basic_group<...>::each() and basic_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:
      for(auto entity: registry.view<position>() | registry.view<velocity>()) {
          // ...
      }
      
      The intended use for this tool is with custom storage/views, but it's also useful in everyday uses.
      The view pack is a view-like object, similar to a multi-type view. It's also iterable and it offers both each(func) and each() as well:
      for(auto [entity, pos, vel]: (registry.view<position>() | registry.view<velocity>()).each()) {
         // ...
      }
      
      A view pack converts to references to its views. See the documentation for further details.
    • 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 of handle 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 customizable poly_storage_traits and const/non-const registry::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 for meta_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 uses entt::any internally rather than meta_storage.
    • Reduced instantiations due to meta_any using a single fake vtable function internally.
    • Added as_ref to create aliases to unmanaged objects with meta_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 for meta_any::convert.
    • Added const and non-const overloads of meta_any::get and meta_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 and as_associative_container to meta_any.
    • Support for pointer-like types with a custom dereference operator other than operator*.
  • poly:

    • Added a new module called poly for automated static polymorphism.
      See the official documentation for all the details and usage instructions.
  • signal:

    • Truly const and therefore const thread safe emitter.
  • 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, storage remove 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, use type_seq instead.
    • has_type_index[_v] utility has been removed.
    • type_info is not longer a class template. See the untyped version of type_info, the type_id function template, other than type_seq, type_hash and type_name for further details.
    • Removed type_list_size[_v], use type_list<T...>::size instead.
    • is_eto_eligible[_v] is now is_empty[_v].
    • Importing entt::literals namespace is required in order to use user defined literals for hashed strings (_hs and _hws).
  • entity:

    • registry::visit and registry::ctx return now a whole type_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> and data<T> because they were misleading.
    • Removed the alias object_type, use value_type instead (storage, pool).
    • Removed basic_group<...>::proxy and basic_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 by storage_traits.
    • Removed member functions ::size<T>, ::empty<T..> and data<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, use meta_type::info instead.
    • Removed resolve_id, use resolve instead.
    • Removed resolve_type, use resolve instead.
    • Removed meta_storage, replaced by entt::any.
    • Removed as_ref tag, no replacement available.
    • Removed meta_any::ref, use as_ref(any) instead.
    • Removed meta_any::convert, use meta_any::allow_cast instead.
  • 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 the test directory for more details.

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.

Don't miss a new entt release

NewReleases is sending notifications on new releases.