[libcxx-commits] [libcxx] [libc++] Implement P0429R9 `std::flat_map` (PR #98643)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Sep 27 12:22:22 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>
+
+// size_type max_size() const noexcept;
+
+#include <cassert>
+#include <flat_map>
+#include <functional>
+#include <limits>
+#include <type_traits>
+#include <vector>
+
+#include "test_allocator.h"
+#include "test_macros.h"
+
+int main(int, char**) {
+ {
+ using A1 = limited_allocator<int, 10>;
+ using A2 = limited_allocator<int, 20>;
+ using C = std::flat_map<int, int, std::less<int>, std::vector<int, A1>, std::vector<int, A2>>;
+ ASSERT_SAME_TYPE(C::difference_type, std::ptrdiff_t);
+ ASSERT_SAME_TYPE(C::size_type, std::size_t);
+ C c;
----------------
ldionne wrote:
If you make this `C const c`, then you're testing that `max_size()` is const-qualified. Applies below as well.
https://github.com/llvm/llvm-project/pull/98643
More information about the libcxx-commits
mailing list