56#ifndef _STL_CONSTRUCT_H
57#define _STL_CONSTRUCT_H 1
73namespace std _GLIBCXX_VISIBILITY(default)
75_GLIBCXX_BEGIN_NAMESPACE_VERSION
77#if __glibcxx_raw_memory_algorithms
78 template <
typename _Tp>
79 _GLIBCXX20_CONSTEXPR
inline void
80 destroy_at(_Tp* __location)
82 if constexpr (__cplusplus > 201703L && is_array_v<_Tp>)
84 for (
auto& __x : *__location)
91#if __cpp_constexpr_dynamic_alloc
92 template<
typename _Tp,
typename... _Args>
94 construct_at(_Tp* __location, _Args&&... __args)
105#if __cplusplus >= 201103L
106 template<
typename _Tp,
typename... _Args>
111#if __cpp_constexpr_dynamic_alloc
112 if (std::__is_constant_evaluated())
122 template<
typename _T1,
typename _T2>
128 ::new(
static_cast<void*
>(__p)) _T1(__value);
132 template<
typename _T1>
134 _Construct_novalue(_T1* __p)
135 { ::new((
void*)__p) _T1; }
137 template<
typename _ForwardIterator>
138 _GLIBCXX20_CONSTEXPR
void
139 _Destroy(_ForwardIterator __first, _ForwardIterator __last);
144 template<
typename _Tp>
145 _GLIBCXX14_CONSTEXPR
inline void
148#if __cpp_constexpr_dynamic_alloc
149 std::destroy_at(__pointer);
155#pragma GCC diagnostic push
156#pragma GCC diagnostic ignored "-Wc++17-extensions"
158#if __cplusplus < 201103L
162 template<
typename _ForwardIterator>
163 static _GLIBCXX20_CONSTEXPR
void
164 __destroy(_ForwardIterator __first, _ForwardIterator __last)
166 for (; __first != __last; ++__first)
170 template<
typename _ForwardIterator,
typename _Size>
171 static _GLIBCXX20_CONSTEXPR _ForwardIterator
172 __destroy_n(_ForwardIterator __first, _Size __count)
174 for (; __count > 0; (void)++__first, --__count)
181 struct _Destroy_aux<true>
183 template<
typename _ForwardIterator>
185 __destroy(_ForwardIterator, _ForwardIterator) { }
187 template<
typename _ForwardIterator,
typename _Size>
188 static _ForwardIterator
189 __destroy_n(_ForwardIterator __first, _Size __count)
202 template<
typename _ForwardIterator>
203 _GLIBCXX20_CONSTEXPR
inline void
204 _Destroy(_ForwardIterator __first, _ForwardIterator __last)
208#if __cplusplus >= 201103L
210 for (; __first != __last; ++__first)
212#if __cpp_constexpr_dynamic_alloc
213 else if (std::__is_constant_evaluated())
214 for (; __first != __last; ++__first)
218 std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
219 __destroy(__first, __last);
228 template<
typename _ForwardIterator,
typename _Size>
229 _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
234#if __cplusplus >= 201103L
236 for (; __count > 0; (void)++__first, --__count)
238#if __cpp_constexpr_dynamic_alloc
239 else if (std::__is_constant_evaluated())
240 for (; __count > 0; (void)++__first, --__count)
247 return std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
248 __destroy_n(__first, __count);
251#pragma GCC diagnostic pop
253#if __glibcxx_raw_memory_algorithms
254 template <
typename _ForwardIterator>
255 _GLIBCXX20_CONSTEXPR
inline void
256 destroy(_ForwardIterator __first, _ForwardIterator __last)
261 template <
typename _ForwardIterator,
typename _Size>
262 _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
263 destroy_n(_ForwardIterator __first, _Size __count)
269_GLIBCXX_END_NAMESPACE_VERSION
auto declval() noexcept -> decltype(__declval< _Tp >(0))
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
ISO C++ entities toplevel namespace is std.
constexpr _ForwardIterator _Destroy_n(_ForwardIterator __first, _Size __count)
constexpr void _Construct(_Tp *__p, _Args &&... __args)
constexpr void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
constexpr void _Destroy(_ForwardIterator __first, _ForwardIterator __last)
is_trivially_destructible
Traits class for iterators.