-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Components without default constructors #8
Comments
Here's the error BTW, it looks like I might have more errors from the types not being movable (I really hope it doesn't require them to be copyable too, haven't gotten there yet though).
al_constant<bool, true> > > > > > > >::, |
Nevermind, I thought about it and I don't really think this library is the tool for what I was trying to do. TL;DR nvm! |
For note for any readers: A no-arg noexcept constructor is required for serializing a component in. It might be possible to alter it to allow components to take, say, a serialization argument so they could unserialize themselves somehow, but in general that really should not be done and components should be more 'pure'. And in my side-opinion, Components should be absolutely 'pure', no code, only data storage... |
@OvermindDL1 @bjadamson: Is there any valid use case for non-default-constructible component types? If this is required for certain projects I can look into it |
Honestly I would say no. In my experience having a component hold anything but raw data is a horrible horrible code smell. Even Components that have logic (which they should not) should not have non-default constructors as it means their state is too intertwined elsewhere, also a horrible code smell. |
Hi, I have another question!
How hard do you think it would be to make it so I can have components that don't have default constructors?
I'd like to be able to pass arguments to the proxy's add_component() method, that would then be forwarded to the components constructor.
For example, I have a triangle class that is immutable after construction:
https://github.com/bjadamson/BoomHS/blob/release/include/engine/gfx/shapes.hpp#L44-L46
But it would be a perfect component, because I can call a function to generate these on demand. Is this possible with the library as is?
The text was updated successfully, but these errors were encountered: