42 lines · c
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef _LIBCPP___VECTOR_CONTAINER_TRAITS_H10#define _LIBCPP___VECTOR_CONTAINER_TRAITS_H11 12#include <__config>13#include <__fwd/vector.h>14#include <__memory/allocator_traits.h>15#include <__type_traits/container_traits.h>16#include <__type_traits/disjunction.h>17#include <__type_traits/is_nothrow_constructible.h>18 19#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)20# pragma GCC system_header21#endif22 23_LIBCPP_BEGIN_NAMESPACE_STD24 25template <class _Tp, class _Allocator>26struct __container_traits<vector<_Tp, _Allocator> > {27 // http://eel.is/c++draft/vector.modifiers#228 // If an exception is thrown other than by the copy constructor, move constructor, assignment operator, or move29 // assignment operator of T or by any InputIterator operation, there are no effects. If an exception is thrown while30 // inserting a single element at the end and T is Cpp17CopyInsertable or is_nothrow_move_constructible_v<T> is true,31 // there are no effects. Otherwise, if an exception is thrown by the move constructor of a non-Cpp17CopyInsertable T,32 // the effects are unspecified.33 static _LIBCPP_CONSTEXPR const bool __emplacement_has_strong_exception_safety_guarantee =34 is_nothrow_move_constructible<_Tp>::value || __is_cpp17_copy_insertable_v<_Allocator>;35 36 static _LIBCPP_CONSTEXPR const bool __reservable = true;37};38 39_LIBCPP_END_NAMESPACE_STD40 41#endif // _LIBCPP___VECTOR_CONTAINER_TRAITS_H42