3 ms·
Yes, that's a nice approach. However, this approach requires you to list all your keys in advance (in the enum). The `semi::static_map` does not require this.T
by hogliux 8y ago
Yes, that's a nice approach. However, this approach requires you to list all your keys in advance (in the enum).
The `semi::static_map` does not require this.This is especially useful if you are writing library code: imagine you are programming a `getFont` method - you don't know with which constexpr keys your method will be called, so there is no way for you to list all these keys in an enum.
- kazinator 8y agoIf you don't like pointlessly repeating occurrences of identifiers, you should hardly be favoring C++. class foo { public: foo(); ~foo(); }; foo::foo() { } foo::~foo() { } Ad nauseum. Oh, but C++ can eliminate redundancy in this one cool case I'm thinking of!