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