56 #ifndef _STL_CONSTRUCT_H 57 #define _STL_CONSTRUCT_H 1 63 namespace std _GLIBCXX_VISIBILITY(default)
65 _GLIBCXX_BEGIN_NAMESPACE_VERSION
71 #if __cplusplus >= 201103L 72 template<
typename _T1,
typename... _Args>
75 { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
77 template<
typename _T1,
typename _T2>
83 ::new(static_cast<void*>(__p)) _T1(__value);
87 template<
typename _T1>
89 _Construct_novalue(_T1* __p)
90 { ::new(static_cast<void*>(__p)) _T1; }
95 template<
typename _Tp>
98 { __pointer->~_Tp(); }
103 template<
typename _ForwardIterator>
105 __destroy(_ForwardIterator __first, _ForwardIterator __last)
107 for (; __first != __last; ++__first)
113 struct _Destroy_aux<true>
115 template<
typename _ForwardIterator>
117 __destroy(_ForwardIterator, _ForwardIterator) { }
125 template<
typename _ForwardIterator>
127 _Destroy(_ForwardIterator __first, _ForwardIterator __last)
129 typedef typename iterator_traits<_ForwardIterator>::value_type
131 #if __cplusplus >= 201103L 134 "value type is destructible");
136 std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
137 __destroy(__first, __last);
141 struct _Destroy_n_aux
143 template<
typename _ForwardIterator,
typename _Size>
144 static _ForwardIterator
145 __destroy_n(_ForwardIterator __first, _Size __count)
147 for (; __count > 0; (void)++__first, --__count)
154 struct _Destroy_n_aux<true>
156 template<
typename _ForwardIterator,
typename _Size>
157 static _ForwardIterator
158 __destroy_n(_ForwardIterator __first, _Size __count)
170 template<
typename _ForwardIterator,
typename _Size>
171 inline _ForwardIterator
174 typedef typename iterator_traits<_ForwardIterator>::value_type
176 #if __cplusplus >= 201103L 179 "value type is destructible");
181 return std::_Destroy_n_aux<__has_trivial_destructor(_Value_type)>::
182 __destroy_n(__first, __count);
191 template<
typename _ForwardIterator,
typename _Allocator>
193 _Destroy(_ForwardIterator __first, _ForwardIterator __last,
197 for (; __first != __last; ++__first)
201 template<
typename _ForwardIterator,
typename _Tp>
203 _Destroy(_ForwardIterator __first, _ForwardIterator __last,
209 #if __cplusplus > 201402L 210 template <
typename _Tp>
212 destroy_at(_Tp* __location)
217 template <
typename _ForwardIterator>
219 destroy(_ForwardIterator __first, _ForwardIterator __last)
224 template <
typename _ForwardIterator,
typename _Size>
225 inline _ForwardIterator
226 destroy_n(_ForwardIterator __first, _Size __count)
232 _GLIBCXX_END_NAMESPACE_VERSION
ISO C++ entities toplevel namespace is std.
Uniform interface to C++98 and C++11 allocators.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
void _Construct(_T1 *__p, _Args &&... __args)
void _Destroy(_Tp *__pointer)
_ForwardIterator _Destroy_n(_ForwardIterator __first, _Size __count)
_GLIBCXX17_CONSTEXPR void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.