ShredEagle / entity

ECS library based on archetypes.
MIT License
0 stars 0 forks source link

It seems impossible to make a Wrap<ComponentA> if ComponentA is not copy constructible #27

Closed FranzPoize closed 1 year ago

FranzPoize commented 1 year ago

It seems that it should be possible to make a Wrap of a move constructible Component. However the lambda capture at Entity.h#249 is not a move capture (or at least I am not understanding why it is not a move capture)

How to reproduce:

Struct componentA {
    std::vector<std::unique_ptr> a;
}

Wrap<componentA> wrap{world};

not sure if this is a problem with just a std::unique_ptr

Adnn commented 1 year ago

Wrap is intended to opt-in storage of custom data as a Component of a dedicated Entity. This way, the custom data becomes part of the SaveState, which is a copy operation.

FranzPoize commented 1 year ago

Everytime !

Well that's why there was a shared_ptr