[libcxx-commits] [libcxx] [libc++] Implement P0429R9 `std::flat_map` (PR #98643)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 29 03:35:25 PDT 2024


================
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <flat_map>
+
+// flat_map iterators should be C++20 random access iterators
+// supporting `operator<=>`, even when the underlying container's
+// iterators are not.
+
+#include <compare>
+#include <concepts>
+#include <flat_map>
+#include <functional>
+
+#include "MinSequenceContainer.h"
+#include "test_macros.h"
+
+int main(int, char**) {
+// V is not a container as <=> is required
+#if 0
----------------
huixie90 wrote:

according to Arthur's comment:

> // flat_map iterators should be C++20 random access iterators
> // supporting `operator<=>`, even when the underlying container's
> // iterators are not.

the comment out test point is to test we added the `operator<=>` to `flat_map::iterator` if underlying `iterator` does not have it. but according to
http://eel.is/c++draft/container.requirements#container.reqmts-39

The underlying random access contain's iterator should always support `<=>`. So I am not sure what is the point of this test now

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


More information about the libcxx-commits mailing list