[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:31 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);
+
+ bool operator<(ThrowOnMove const&) const;
+ bool operator==(ThrowOnMove const&) const;
+};
+
+struct NonCopyThrowOnMove {
+ NonCopyThrowOnMove();
+ NonCopyThrowOnMove(ThrowOnMove&&) _NOEXCEPT_(false);
+ NonCopyThrowOnMove(const NonCopyThrowOnMove&) = delete;
+ NonCopyThrowOnMove& operator=(ThrowOnMove&&) _NOEXCEPT_(false);
----------------
ldionne wrote:
```suggestion
NonCopyThrowOnMove& operator=(NonCopyThrowOnMove&&) _NOEXCEPT_(false);
```
Would be good to understand why the tests passed despite that.
https://github.com/llvm/llvm-project/pull/109578
More information about the libcxx-commits
mailing list