[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:30 PDT 2024
================
@@ -3005,6 +3007,19 @@ public:
};
#endif // _LIBCPP_STD_VER >= 23
+template <class _Tp, class _Allocator>
+struct __container_traits<vector<_Tp, _Allocator> > {
+ // http://eel.is/c++draft/vector.modifiers#2
+ // If an exception is thrown other than by the copy constructor, move constructor, assignment operator, or move
+ // assignment operator of T or by any InputIterator operation, there are no effects. If an exception is thrown while
+ // inserting a single element at the end and T is Cpp17CopyInsertable or is_nothrow_move_constructible_v<T> is true,
+ // there are no effects. Otherwise, if an exception is thrown by the move constructor of a non-Cpp17CopyInsertable T,
+ // the effects are unspecified.
+ using __emplacement_has_strong_exception_safety_guarantee =
+ _Or<is_nothrow_move_constructible<_Tp>,
+ __is_cpp17_copy_insertable<typename vector<_Tp, _Allocator>::allocator_type> >;
----------------
ldionne wrote:
```suggestion
__is_cpp17_copy_insertable<_Allocator> >;
```
https://github.com/llvm/llvm-project/pull/109578
More information about the libcxx-commits
mailing list