Replies: 1 comment 4 replies
-
You mean as in enable it for |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a project in which I use entt in more than one structure. Leaving out a lot of detail it basically boils down to this
For
Scene
I am fine with not having any guarantees on pointer stability.For
SomethingElse
however I could make my life easier if pointer stability was enabled.The docs mentioned the feature but I had some trouble understanding it.
After searching the source a little bit it seems to me that I have two (maybe three?) options
A: I change
in_place_deletion
in component.hpp to true. This would do the trick but then I have in-place deletion enabled in the whole project which means forScene
as well.B: I specialize
component_traits
for every component that I intend to use withSomethingElse::Reg
. If I understood correctly this would look something like this (at least I tried it and it worked).However now I have to make sure that whenever me or someone else in the team adds a new component, the spcialization gets added as well which could be easily forgotten.
C: I don't know how but maybe there is a way to change
in_place_deletion
in basic_component_traits to true without editing component.hpp? It would seem a bit strange to me that I have to edit entt source for that. But even if there was that possibilty, this would mean I'd have to guarantee that whatever code enables it can never by seen byScene
in any compilation unit which would be a problem.TLDR; Can I enable in-place deletion for only a selection of basic_registry types?
(Btw. great job on entt. I enjoy using it a lot and the template magic required for it to work is completely beyond me!)
EDIT:
The wiki also shows an example where
static constexpr auto in_place_delete = true;
is simply defined in the components. While this would still suffer from the issues that it can be forgotten it would at be less code than thecomponent_trait
specialization. However it does not seem to work for me.Beta Was this translation helpful? Give feedback.
All reactions