[libcxx-commits] [libcxx] [libc++] implement `std::flat_multimap` (PR #113835)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Nov 8 11:29:21 PST 2024


================
@@ -35,12 +35,33 @@ namespace std {
            class Predicate>
     typename flat_map<Key, T, Compare, KeyContainer, MappedContainer>::size_type
       erase_if(flat_map<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred);
+
+  // [flat.multimap], class template flat_multimap
+  template<class Key, class T, class Compare = less<Key>,
+           class KeyContainer = vector<Key>, class MappedContainer = vector<T>>
+    class flat_multimap;
+
+  struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; };
+  inline constexpr sorted_equivalent_t sorted_equivalent{};
+
+  template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
+           class Allocator>
+    struct uses_allocator<flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>,
+                          Allocator>;
+
+  // [flat.multimap.erasure], erasure for flat_multimap
+  template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
+           class Predicate>
+    typename flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>::size_type
+      erase_if(flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred);
 */
 
 #include <__assert> // all public C++ headers provide the assertion handler
 #include <__config>
 #include <__flat_map/flat_map.h>
+#include <__flat_map/flat_multimap.h>
 #include <__flat_map/sorted_unique.h>
+#include <__flat_map/sorted_equivalent.h>
----------------
ldionne wrote:

I personally appreciate having the types in separate headers. They are rather large and complicated types, and it helps me navigate around. This is somewhat of a personal preference, but I think it makes sense to stick with what we do for vector.

https://github.com/llvm/llvm-project/pull/113835


More information about the libcxx-commits mailing list