Skip to content

Conversation

@frederick-vs-ja
Copy link
Contributor

@frederick-vs-ja frederick-vs-ja commented Jan 14, 2024

Addresses #4056, towards #2910, enabling flat_map (and, possibly, yet-to-implement flat_multimap) for permissive modes.

Other cleanups in the product code:

  • Changes the "true name" of iterator types from type to _Iterator, as they are not transforming type traits.
  • Possibly enables NRVO in iterator arithmetic operators.
  • Drops _STD for trait variable templates.
  • Uses auto for iterators obtained from begin() etc..
  • Uses _STL_INTERNAL_STATIC_ASSERT for invariants maintained by implementations that should never be violated.

Other cleanups in the test:

  • Drops all redundant std::.
  • Drops redundant return 0; in main().
  • Drops redundant constructor inheritance for comparators - only default constructors are used.
  • Avoids dependency on internal _Is_specialization_v.
  • Simplifies some function templates with the fact that remove_cvref_t<T&&> is always same as remove_cvref_t<T>.
  • Changes variable name map to fmap as these variables are unrelated to std::map.

The current implementation is not SCARY enough, e.g. the iterator types may still depend on allocator types (modulo possibly fancy pointers). I'll change this in another PR.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner January 14, 2024 10:13
@StephanTLavavej StephanTLavavej added the flat_meow C++23 container adaptors label Jan 15, 2024
@StephanTLavavej StephanTLavavej self-assigned this Jan 15, 2024
@StephanTLavavej StephanTLavavej merged commit 2355b8c into microsoft:feature/flat_map Jan 16, 2024
@StephanTLavavej
Copy link
Member

Thanks! I had a few comments for followup, but overall this looked great so I went ahead and merged it. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flat_meow C++23 container adaptors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants