xref: /llvm-project/libcxx/include/__vector/container_traits.h (revision 2e43a304f10fd801f068d0f9831f01f2c5b0b2e2)
1*2e43a304SNikolas Klauser //===----------------------------------------------------------------------===//
2*2e43a304SNikolas Klauser //
3*2e43a304SNikolas Klauser // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*2e43a304SNikolas Klauser // See https://llvm.org/LICENSE.txt for license information.
5*2e43a304SNikolas Klauser // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*2e43a304SNikolas Klauser //
7*2e43a304SNikolas Klauser //===----------------------------------------------------------------------===//
8*2e43a304SNikolas Klauser 
9*2e43a304SNikolas Klauser #ifndef _LIBCPP___VECTOR_CONTAINER_TRAITS_H
10*2e43a304SNikolas Klauser #define _LIBCPP___VECTOR_CONTAINER_TRAITS_H
11*2e43a304SNikolas Klauser 
12*2e43a304SNikolas Klauser #include <__config>
13*2e43a304SNikolas Klauser #include <__fwd/vector.h>
14*2e43a304SNikolas Klauser #include <__memory/allocator_traits.h>
15*2e43a304SNikolas Klauser #include <__type_traits/container_traits.h>
16*2e43a304SNikolas Klauser #include <__type_traits/disjunction.h>
17*2e43a304SNikolas Klauser #include <__type_traits/is_nothrow_constructible.h>
18*2e43a304SNikolas Klauser 
19*2e43a304SNikolas Klauser #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20*2e43a304SNikolas Klauser #  pragma GCC system_header
21*2e43a304SNikolas Klauser #endif
22*2e43a304SNikolas Klauser 
23*2e43a304SNikolas Klauser _LIBCPP_BEGIN_NAMESPACE_STD
24*2e43a304SNikolas Klauser 
25*2e43a304SNikolas Klauser template <class _Tp, class _Allocator>
26*2e43a304SNikolas Klauser struct __container_traits<vector<_Tp, _Allocator> > {
27*2e43a304SNikolas Klauser   // http://eel.is/c++draft/vector.modifiers#2
28*2e43a304SNikolas Klauser   //  If an exception is thrown other than by the copy constructor, move constructor, assignment operator, or move
29*2e43a304SNikolas Klauser   //  assignment operator of T or by any InputIterator operation, there are no effects. If an exception is thrown while
30*2e43a304SNikolas Klauser   //  inserting a single element at the end and T is Cpp17CopyInsertable or is_nothrow_move_constructible_v<T> is true,
31*2e43a304SNikolas Klauser   //  there are no effects. Otherwise, if an exception is thrown by the move constructor of a non-Cpp17CopyInsertable T,
32*2e43a304SNikolas Klauser   //  the effects are unspecified.
33*2e43a304SNikolas Klauser   static _LIBCPP_CONSTEXPR const bool __emplacement_has_strong_exception_safety_guarantee =
34*2e43a304SNikolas Klauser       _Or<is_nothrow_move_constructible<_Tp>, __is_cpp17_copy_insertable<_Allocator> >::value;
35*2e43a304SNikolas Klauser };
36*2e43a304SNikolas Klauser 
37*2e43a304SNikolas Klauser _LIBCPP_END_NAMESPACE_STD
38*2e43a304SNikolas Klauser 
39*2e43a304SNikolas Klauser #endif // _LIBCPP___VECTOR_CONTAINER_TRAITS_H
40