[libcxx-commits] [libcxx] [libc++] Add container_traits (prework for `std::flat_map`) (PR #109578)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 27 10:36:32 PDT 2024


================
@@ -0,0 +1,173 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// <__type_traits/container_traits.h>
+//
+
+#include <__type_traits/container_traits.h>
+
+#include <deque>
+#include <forward_list>
+#include <list>
+#include <vector>
+#include <map>
+#include <set>
+#include <unordered_map>
+#include <unordered_set>
+
+#include "test_allocator.h"
+#include "test_macros.h"
+#include "MoveOnly.h"
+
+struct ThrowOnMove {
+  ThrowOnMove();
+  ThrowOnMove(const ThrowOnMove&) _NOEXCEPT_(false);
+  ThrowOnMove(ThrowOnMove&&) _NOEXCEPT_(false);
+  ThrowOnMove& operator=(ThrowOnMove&&) _NOEXCEPT_(false);
+  ThrowOnMove& operator=(const ThrowOnMove&) _NOEXCEPT_(false);
----------------
ldionne wrote:

```suggestion
  ThrowOnMove(const ThrowOnMove&) TEST_NOEXCEPT_COND(false);
  ThrowOnMove(ThrowOnMove&&) TEST_NOEXCEPT_COND(false);
  ThrowOnMove& operator=(ThrowOnMove&&) TEST_NOEXCEPT_COND(false);
  ThrowOnMove& operator=(const ThrowOnMove&) TEST_NOEXCEPT_COND(false);
```

That makes the tests more portable.

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


More information about the libcxx-commits mailing list