From 24ba6928848f6c0bd79bd29ea6ff2f799f1fa859 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Wed, 19 Dec 2018 14:18:59 +0100 Subject: [PATCH] delegate: support for curried functions --- TODO | 2 - docs/entity.md | 6 +-- docs/signal.md | 34 ++++++++++++ src/entt/signal/delegate.hpp | 99 ++++++++++++++++++++--------------- test/entt/signal/delegate.cpp | 20 +++++++ 5 files changed, 114 insertions(+), 47 deletions(-) diff --git a/TODO b/TODO index 061ad8002..8b8c1ee3d 100644 --- a/TODO +++ b/TODO @@ -7,7 +7,6 @@ * define basic reactive systems (track entities to which component is attached, track entities from which component is removed, and so on) * define systems as composable mixins (initializazion, reactive, update, whatever) with flexible auto-detected arguments (registry, views, etc) * runner proposal: https://en.wikipedia.org/wiki/Fork%E2%80%93join_model https://slide-rs.github.io/specs/03_dispatcher.html -* deep copy of a registry (or use the snapshot stuff to copy components and keep intact ids at least) * is it possible to iterate all the components assigned to an entity through a common base class? * can we do more for shared libraries? who knows... see #144 * work stealing job system (see #100) @@ -23,4 +22,3 @@ * monostate: make constraint trivially copyable due to atomic optional * travis + windows is now available, try it * events on replace, so that one can track updated components? indagate impact -* allow to bind values to delegate on connect with free functions (sbo + check size on costruction to guarantee a zero allocation abstraction) diff --git a/docs/entity.md b/docs/entity.md index 86b1ea3d9..c4165cadb 100644 --- a/docs/entity.md +++ b/docs/entity.md @@ -1034,7 +1034,7 @@ Persistent views are used mainly to iterate multiple components at once: auto view = registry.persistent_view(); ``` -Moreover, filters can be applied to a persistent view to some extents: +Filtering entities by components is also supported: ```cpp auto view = registry.persistent_view(entt::type_list); @@ -1043,8 +1043,8 @@ auto view = registry.persistent_view(entt::type_list Exclusive filters (ie the entities that have either `position` or `velocity`) -aren't supported for performance reasons. Similarly, a filter cannot be applied -to a persistent view with an empty template parameters list. +aren't directly supported for performance reasons. Similarly, a filter cannot be +applied to a persistent view with an empty template parameters list. There is no need to store views around for they are extremely cheap to construct, even though they can be copied without problems and reused freely. In diff --git a/docs/signal.md b/docs/signal.md index 6278c642e..a6b6fee94 100644 --- a/docs/signal.md +++ b/docs/signal.md @@ -8,6 +8,7 @@ * [Introduction](#introduction) * [Signals](#signals) * [Delegate](#delegate) + * [Currying and free functions](#currying-and-free-functions) * [Event dispatcher](#event-dispatcher) * [Event emitter](#event-emitter)