56 #ifndef _STL_CONSTRUCT_H
57 #define _STL_CONSTRUCT_H 1
65 _GLIBCXX_BEGIN_NAMESPACE_VERSION
71 #if __cplusplus >= 201103L
72 template<
typename _T1,
typename... _Args>
74 _Construct(_T1* __p, _Args&&... __args)
75 { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
77 template<
typename _T1,
typename _T2>
79 _Construct(_T1* __p,
const _T2& __value)
83 ::new(static_cast<void*>(__p)) _T1(__value);
90 template<
typename _Tp>
92 _Destroy(_Tp* __pointer)
93 { __pointer->~_Tp(); }
98 template<
typename _ForwardIterator>
100 __destroy(_ForwardIterator __first, _ForwardIterator __last)
102 for (; __first != __last; ++__first)
103 std::_Destroy(std::__addressof(*__first));
108 struct _Destroy_aux<true>
110 template<
typename _ForwardIterator>
112 __destroy(_ForwardIterator, _ForwardIterator) { }
120 template<
typename _ForwardIterator>
122 _Destroy(_ForwardIterator __first, _ForwardIterator __last)
124 typedef typename iterator_traits<_ForwardIterator>::value_type
126 std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
127 __destroy(__first, __last);
136 template<
typename _ForwardIterator,
typename _Allocator>
138 _Destroy(_ForwardIterator __first, _ForwardIterator __last,
141 typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
142 for (; __first != __last; ++__first)
143 __traits::destroy(__alloc, std::__addressof(*__first));
146 template<
typename _ForwardIterator,
typename _Tp>
148 _Destroy(_ForwardIterator __first, _ForwardIterator __last,
151 _Destroy(__first, __last);
154 _GLIBCXX_END_NAMESPACE_VERSION
namespace std _GLIBCXX_VISIBILITY(default)
Definition: stl_construct.h:63