-
Notifications
You must be signed in to change notification settings - Fork 140
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
Allow for aggregate initialization in descriptors #84
Comments
It's true there are several constructors to emulate aggregate initialization, but the reason is that aggregate initialization does not work in conjunction with default initializers, at least not in C++11. According to cppreference.com, a struct with default member initializers is not an aggregate until C++14: The idea for default initializers in the public interfaces is purely for stability. Perhaps utilizing C++14 feature __cpp_aggregate_nsdmi is worth considering. On the other hand, though, explicit constructors allow to specify how many members should be initialized at once, for instance Having said that, some structs would definitely benefit from C++20's designed initialization (a feature that exists since C99 btw), like |
Ah, I didn't realize that default member initialization prevented it being an aggregate until C++14. In my project I am using C++20 to see how the modern features would play with low level graphics. Luckily most of the large descriptors (e.g. The descriptors I noted not having aggregation in C++20 were Using explicit constructors to specify how many members should be initialized at once is a good idea, however, to keep with aggregate initialization with this constraint, you could make helper utility functions to construct it so designated initializers can still be made to whoever wants to (much like Overall I think the library is great and thanks for making it. |
Thank you for your feedback. |
I noticed that there are a lot of structures with unnecessary constructors which just emulate aggregate initialization. Would it be possible to remove the various constructors/assignment operators to allow for aggregate initialization. This would also allow for C++20's designated initialization if compiling with C++20.
The text was updated successfully, but these errors were encountered: