summaryrefslogtreecommitdiff
path: root/libcxx/include/deque
diff options
context:
space:
mode:
authorHui <hui.xie1990@gmail.com>2024-10-12 18:29:59 +0100
committerGitHub <noreply@github.com>2024-10-12 18:29:59 +0100
commit8f9cce0bef317076fbdce677d6d6744ebd5dc02a (patch)
tree518dcc2e55f241f1baa46cf5e9bd4e0c089eae6b /libcxx/include/deque
parenta3bad9adcbf7c7cc92d913a0c6369961aac6d195 (diff)
[libc++] Add container_traits (prework for `std::flat_map`) (#109578)
This PR is extracted from https://github.com/llvm/llvm-project/pull/98643, as per code review request https://github.com/llvm/llvm-project/pull/98643#discussion_r1768967793
Diffstat (limited to 'libcxx/include/deque')
-rw-r--r--libcxx/include/deque13
1 files changed, 13 insertions, 0 deletions
diff --git a/libcxx/include/deque b/libcxx/include/deque
index fa67916ba11b..11219d1a9924 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -220,6 +220,8 @@ template <class T, class Allocator, class Predicate>
#include <__ranges/size.h>
#include <__split_buffer>
#include <__type_traits/conditional.h>
+#include <__type_traits/container_traits.h>
+#include <__type_traits/disjunction.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_allocator.h>
#include <__type_traits/is_convertible.h>
@@ -2609,6 +2611,17 @@ inline constexpr bool __format::__enable_insertable<std::deque<wchar_t>> = true;
#endif // _LIBCPP_STD_VER >= 20
+template <class _Tp, class _Allocator>
+struct __container_traits<deque<_Tp, _Allocator> > {
+ // http://eel.is/c++draft/deque.modifiers#3
+ // If an exception is thrown other than by the copy constructor, move constructor, assignment operator, or move
+ // assignment operator of T, there are no effects. If an exception is thrown while inserting a single element at
+ // either end, there are no effects. Otherwise, if an exception is thrown by the move constructor of a
+ // non-Cpp17CopyInsertable T, the effects are unspecified.
+ static _LIBCPP_CONSTEXPR const bool __emplacement_has_strong_exception_safety_guarantee =
+ _Or<is_nothrow_move_constructible<_Tp>, __is_cpp17_copy_insertable<_Allocator> >::value;
+};
+
_LIBCPP_END_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17