3 ms·
Unfortunately the restrictions added in C++20 make designated initialization quite pointless for any structs or classes with more than a handful items. Having t
by flohofwoe 6y ago
Unfortunately the restrictions added in C++20 make designated initialization quite pointless for any structs or classes with more than a handful items. Having to remember the order of initialization is too much hassle in this case.
- hmry 6y agoThat's what I thought too, until I actually used them extensively. The compiler tells you the correct order when you get it wrong, and I'm sure if you used an IDE (I don't) it would help you as well. And that was with Vulkan, everything in that API is done by creating structs with way too many members.
- flohofwoe 6y agoThat sounds like a game of Tetris though, with or without IDE support ;) It would have been better if C++ treated structs like C structs, not like classes, but too late for that I guess.
- mfost 6y agoThis completely ignores the advantages they have in code readability and reliability. I can well deal with a little extra effort to order the initializations for those benefits. Now, if you complained about the burden on refactoring member orders it poses on the other hand?