File indexing completed on 2026-05-03 08:13:35
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___CXX03___MEMORY_SWAP_ALLOCATOR_H
0010 #define _LIBCPP___CXX03___MEMORY_SWAP_ALLOCATOR_H
0011
0012 #include <__cxx03/__config>
0013 #include <__cxx03/__memory/allocator_traits.h>
0014 #include <__cxx03/__type_traits/integral_constant.h>
0015 #include <__cxx03/__type_traits/is_swappable.h>
0016 #include <__cxx03/__utility/swap.h>
0017
0018 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0019 # pragma GCC system_header
0020 #endif
0021
0022 _LIBCPP_BEGIN_NAMESPACE_STD
0023
0024 template <typename _Alloc>
0025 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swap_allocator(_Alloc& __a1, _Alloc& __a2, true_type)
0026 #if _LIBCPP_STD_VER >= 14
0027 _NOEXCEPT
0028 #else
0029 _NOEXCEPT_(__is_nothrow_swappable_v<_Alloc>)
0030 #endif
0031 {
0032 using std::swap;
0033 swap(__a1, __a2);
0034 }
0035
0036 template <typename _Alloc>
0037 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
0038 __swap_allocator(_Alloc&, _Alloc&, false_type) _NOEXCEPT {}
0039
0040 template <typename _Alloc>
0041 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swap_allocator(_Alloc& __a1, _Alloc& __a2)
0042 #if _LIBCPP_STD_VER >= 14
0043 _NOEXCEPT
0044 #else
0045 _NOEXCEPT_(__is_nothrow_swappable_v<_Alloc>)
0046 #endif
0047 {
0048 std::__swap_allocator(
0049 __a1, __a2, integral_constant<bool, allocator_traits<_Alloc>::propagate_on_container_swap::value>());
0050 }
0051
0052 _LIBCPP_END_NAMESPACE_STD
0053
0054 #endif