Details
-
Improvement
-
Resolution: Won't Do
-
Major - P3
-
None
-
None
-
None
-
None
-
Dev Tools 2019-09-09, Dev Tools 2019-09-09, Dev Tools 2019-09-23
Description
I recently ended up creating translation unit-static functions for more strict access patterns with stdx::unordered_map/_set. I suspect that a set of helpers with invariants might be more useful to the codebase at large:
- getOrInvariant() which invariants that the key already exists (roughly equivalent to at()).
- emplaceOrInvariant() which invariants that the key did not already exist.
- eraseOrInvariant() which invariants that the key existed and will no longer.
This set of operations allows a developer to confidently use a map or set to contain a unique set of initialized objects.