1*38fd1498Szrj // Raw memory manipulators -*- C++ -*-
2*38fd1498Szrj
3*38fd1498Szrj // Copyright (C) 2001-2018 Free Software Foundation, Inc.
4*38fd1498Szrj //
5*38fd1498Szrj // This file is part of the GNU ISO C++ Library. This library is free
6*38fd1498Szrj // software; you can redistribute it and/or modify it under the
7*38fd1498Szrj // terms of the GNU General Public License as published by the
8*38fd1498Szrj // Free Software Foundation; either version 3, or (at your option)
9*38fd1498Szrj // any later version.
10*38fd1498Szrj
11*38fd1498Szrj // This library is distributed in the hope that it will be useful,
12*38fd1498Szrj // but WITHOUT ANY WARRANTY; without even the implied warranty of
13*38fd1498Szrj // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14*38fd1498Szrj // GNU General Public License for more details.
15*38fd1498Szrj
16*38fd1498Szrj // Under Section 7 of GPL version 3, you are granted additional
17*38fd1498Szrj // permissions described in the GCC Runtime Library Exception, version
18*38fd1498Szrj // 3.1, as published by the Free Software Foundation.
19*38fd1498Szrj
20*38fd1498Szrj // You should have received a copy of the GNU General Public License and
21*38fd1498Szrj // a copy of the GCC Runtime Library Exception along with this program;
22*38fd1498Szrj // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23*38fd1498Szrj // <http://www.gnu.org/licenses/>.
24*38fd1498Szrj
25*38fd1498Szrj /*
26*38fd1498Szrj *
27*38fd1498Szrj * Copyright (c) 1994
28*38fd1498Szrj * Hewlett-Packard Company
29*38fd1498Szrj *
30*38fd1498Szrj * Permission to use, copy, modify, distribute and sell this software
31*38fd1498Szrj * and its documentation for any purpose is hereby granted without fee,
32*38fd1498Szrj * provided that the above copyright notice appear in all copies and
33*38fd1498Szrj * that both that copyright notice and this permission notice appear
34*38fd1498Szrj * in supporting documentation. Hewlett-Packard Company makes no
35*38fd1498Szrj * representations about the suitability of this software for any
36*38fd1498Szrj * purpose. It is provided "as is" without express or implied warranty.
37*38fd1498Szrj *
38*38fd1498Szrj *
39*38fd1498Szrj * Copyright (c) 1996,1997
40*38fd1498Szrj * Silicon Graphics Computer Systems, Inc.
41*38fd1498Szrj *
42*38fd1498Szrj * Permission to use, copy, modify, distribute and sell this software
43*38fd1498Szrj * and its documentation for any purpose is hereby granted without fee,
44*38fd1498Szrj * provided that the above copyright notice appear in all copies and
45*38fd1498Szrj * that both that copyright notice and this permission notice appear
46*38fd1498Szrj * in supporting documentation. Silicon Graphics makes no
47*38fd1498Szrj * representations about the suitability of this software for any
48*38fd1498Szrj * purpose. It is provided "as is" without express or implied warranty.
49*38fd1498Szrj */
50*38fd1498Szrj
51*38fd1498Szrj /** @file bits/stl_uninitialized.h
52*38fd1498Szrj * This is an internal header file, included by other library headers.
53*38fd1498Szrj * Do not attempt to use it directly. @headername{memory}
54*38fd1498Szrj */
55*38fd1498Szrj
56*38fd1498Szrj #ifndef _STL_UNINITIALIZED_H
57*38fd1498Szrj #define _STL_UNINITIALIZED_H 1
58*38fd1498Szrj
59*38fd1498Szrj #if __cplusplus > 201402L
60*38fd1498Szrj #include <utility>
61*38fd1498Szrj #endif
62*38fd1498Szrj
63*38fd1498Szrj #if __cplusplus >= 201103L
64*38fd1498Szrj #include <type_traits>
65*38fd1498Szrj #endif
66*38fd1498Szrj
_GLIBCXX_VISIBILITY(default)67*38fd1498Szrj namespace std _GLIBCXX_VISIBILITY(default)
68*38fd1498Szrj {
69*38fd1498Szrj _GLIBCXX_BEGIN_NAMESPACE_VERSION
70*38fd1498Szrj
71*38fd1498Szrj template<bool _TrivialValueTypes>
72*38fd1498Szrj struct __uninitialized_copy
73*38fd1498Szrj {
74*38fd1498Szrj template<typename _InputIterator, typename _ForwardIterator>
75*38fd1498Szrj static _ForwardIterator
76*38fd1498Szrj __uninit_copy(_InputIterator __first, _InputIterator __last,
77*38fd1498Szrj _ForwardIterator __result)
78*38fd1498Szrj {
79*38fd1498Szrj _ForwardIterator __cur = __result;
80*38fd1498Szrj __try
81*38fd1498Szrj {
82*38fd1498Szrj for (; __first != __last; ++__first, (void)++__cur)
83*38fd1498Szrj std::_Construct(std::__addressof(*__cur), *__first);
84*38fd1498Szrj return __cur;
85*38fd1498Szrj }
86*38fd1498Szrj __catch(...)
87*38fd1498Szrj {
88*38fd1498Szrj std::_Destroy(__result, __cur);
89*38fd1498Szrj __throw_exception_again;
90*38fd1498Szrj }
91*38fd1498Szrj }
92*38fd1498Szrj };
93*38fd1498Szrj
94*38fd1498Szrj template<>
95*38fd1498Szrj struct __uninitialized_copy<true>
96*38fd1498Szrj {
97*38fd1498Szrj template<typename _InputIterator, typename _ForwardIterator>
98*38fd1498Szrj static _ForwardIterator
99*38fd1498Szrj __uninit_copy(_InputIterator __first, _InputIterator __last,
100*38fd1498Szrj _ForwardIterator __result)
101*38fd1498Szrj { return std::copy(__first, __last, __result); }
102*38fd1498Szrj };
103*38fd1498Szrj
104*38fd1498Szrj /**
105*38fd1498Szrj * @brief Copies the range [first,last) into result.
106*38fd1498Szrj * @param __first An input iterator.
107*38fd1498Szrj * @param __last An input iterator.
108*38fd1498Szrj * @param __result An output iterator.
109*38fd1498Szrj * @return __result + (__first - __last)
110*38fd1498Szrj *
111*38fd1498Szrj * Like copy(), but does not require an initialized output range.
112*38fd1498Szrj */
113*38fd1498Szrj template<typename _InputIterator, typename _ForwardIterator>
114*38fd1498Szrj inline _ForwardIterator
115*38fd1498Szrj uninitialized_copy(_InputIterator __first, _InputIterator __last,
116*38fd1498Szrj _ForwardIterator __result)
117*38fd1498Szrj {
118*38fd1498Szrj typedef typename iterator_traits<_InputIterator>::value_type
119*38fd1498Szrj _ValueType1;
120*38fd1498Szrj typedef typename iterator_traits<_ForwardIterator>::value_type
121*38fd1498Szrj _ValueType2;
122*38fd1498Szrj #if __cplusplus < 201103L
123*38fd1498Szrj const bool __assignable = true;
124*38fd1498Szrj #else
125*38fd1498Szrj // trivial types can have deleted assignment
126*38fd1498Szrj typedef typename iterator_traits<_InputIterator>::reference _RefType1;
127*38fd1498Szrj typedef typename iterator_traits<_ForwardIterator>::reference _RefType2;
128*38fd1498Szrj const bool __assignable = is_assignable<_RefType2, _RefType1>::value;
129*38fd1498Szrj #endif
130*38fd1498Szrj
131*38fd1498Szrj return std::__uninitialized_copy<__is_trivial(_ValueType1)
132*38fd1498Szrj && __is_trivial(_ValueType2)
133*38fd1498Szrj && __assignable>::
134*38fd1498Szrj __uninit_copy(__first, __last, __result);
135*38fd1498Szrj }
136*38fd1498Szrj
137*38fd1498Szrj
138*38fd1498Szrj template<bool _TrivialValueType>
139*38fd1498Szrj struct __uninitialized_fill
140*38fd1498Szrj {
141*38fd1498Szrj template<typename _ForwardIterator, typename _Tp>
142*38fd1498Szrj static void
143*38fd1498Szrj __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
144*38fd1498Szrj const _Tp& __x)
145*38fd1498Szrj {
146*38fd1498Szrj _ForwardIterator __cur = __first;
147*38fd1498Szrj __try
148*38fd1498Szrj {
149*38fd1498Szrj for (; __cur != __last; ++__cur)
150*38fd1498Szrj std::_Construct(std::__addressof(*__cur), __x);
151*38fd1498Szrj }
152*38fd1498Szrj __catch(...)
153*38fd1498Szrj {
154*38fd1498Szrj std::_Destroy(__first, __cur);
155*38fd1498Szrj __throw_exception_again;
156*38fd1498Szrj }
157*38fd1498Szrj }
158*38fd1498Szrj };
159*38fd1498Szrj
160*38fd1498Szrj template<>
161*38fd1498Szrj struct __uninitialized_fill<true>
162*38fd1498Szrj {
163*38fd1498Szrj template<typename _ForwardIterator, typename _Tp>
164*38fd1498Szrj static void
165*38fd1498Szrj __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
166*38fd1498Szrj const _Tp& __x)
167*38fd1498Szrj { std::fill(__first, __last, __x); }
168*38fd1498Szrj };
169*38fd1498Szrj
170*38fd1498Szrj /**
171*38fd1498Szrj * @brief Copies the value x into the range [first,last).
172*38fd1498Szrj * @param __first An input iterator.
173*38fd1498Szrj * @param __last An input iterator.
174*38fd1498Szrj * @param __x The source value.
175*38fd1498Szrj * @return Nothing.
176*38fd1498Szrj *
177*38fd1498Szrj * Like fill(), but does not require an initialized output range.
178*38fd1498Szrj */
179*38fd1498Szrj template<typename _ForwardIterator, typename _Tp>
180*38fd1498Szrj inline void
181*38fd1498Szrj uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last,
182*38fd1498Szrj const _Tp& __x)
183*38fd1498Szrj {
184*38fd1498Szrj typedef typename iterator_traits<_ForwardIterator>::value_type
185*38fd1498Szrj _ValueType;
186*38fd1498Szrj #if __cplusplus < 201103L
187*38fd1498Szrj const bool __assignable = true;
188*38fd1498Szrj #else
189*38fd1498Szrj // trivial types can have deleted assignment
190*38fd1498Szrj const bool __assignable = is_copy_assignable<_ValueType>::value;
191*38fd1498Szrj #endif
192*38fd1498Szrj
193*38fd1498Szrj std::__uninitialized_fill<__is_trivial(_ValueType) && __assignable>::
194*38fd1498Szrj __uninit_fill(__first, __last, __x);
195*38fd1498Szrj }
196*38fd1498Szrj
197*38fd1498Szrj
198*38fd1498Szrj template<bool _TrivialValueType>
199*38fd1498Szrj struct __uninitialized_fill_n
200*38fd1498Szrj {
201*38fd1498Szrj template<typename _ForwardIterator, typename _Size, typename _Tp>
202*38fd1498Szrj static _ForwardIterator
203*38fd1498Szrj __uninit_fill_n(_ForwardIterator __first, _Size __n,
204*38fd1498Szrj const _Tp& __x)
205*38fd1498Szrj {
206*38fd1498Szrj _ForwardIterator __cur = __first;
207*38fd1498Szrj __try
208*38fd1498Szrj {
209*38fd1498Szrj for (; __n > 0; --__n, (void) ++__cur)
210*38fd1498Szrj std::_Construct(std::__addressof(*__cur), __x);
211*38fd1498Szrj return __cur;
212*38fd1498Szrj }
213*38fd1498Szrj __catch(...)
214*38fd1498Szrj {
215*38fd1498Szrj std::_Destroy(__first, __cur);
216*38fd1498Szrj __throw_exception_again;
217*38fd1498Szrj }
218*38fd1498Szrj }
219*38fd1498Szrj };
220*38fd1498Szrj
221*38fd1498Szrj template<>
222*38fd1498Szrj struct __uninitialized_fill_n<true>
223*38fd1498Szrj {
224*38fd1498Szrj template<typename _ForwardIterator, typename _Size, typename _Tp>
225*38fd1498Szrj static _ForwardIterator
226*38fd1498Szrj __uninit_fill_n(_ForwardIterator __first, _Size __n,
227*38fd1498Szrj const _Tp& __x)
228*38fd1498Szrj { return std::fill_n(__first, __n, __x); }
229*38fd1498Szrj };
230*38fd1498Szrj
231*38fd1498Szrj // _GLIBCXX_RESOLVE_LIB_DEFECTS
232*38fd1498Szrj // DR 1339. uninitialized_fill_n should return the end of its range
233*38fd1498Szrj /**
234*38fd1498Szrj * @brief Copies the value x into the range [first,first+n).
235*38fd1498Szrj * @param __first An input iterator.
236*38fd1498Szrj * @param __n The number of copies to make.
237*38fd1498Szrj * @param __x The source value.
238*38fd1498Szrj * @return Nothing.
239*38fd1498Szrj *
240*38fd1498Szrj * Like fill_n(), but does not require an initialized output range.
241*38fd1498Szrj */
242*38fd1498Szrj template<typename _ForwardIterator, typename _Size, typename _Tp>
243*38fd1498Szrj inline _ForwardIterator
244*38fd1498Szrj uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
245*38fd1498Szrj {
246*38fd1498Szrj typedef typename iterator_traits<_ForwardIterator>::value_type
247*38fd1498Szrj _ValueType;
248*38fd1498Szrj #if __cplusplus < 201103L
249*38fd1498Szrj const bool __assignable = true;
250*38fd1498Szrj #else
251*38fd1498Szrj // trivial types can have deleted assignment
252*38fd1498Szrj const bool __assignable = is_copy_assignable<_ValueType>::value;
253*38fd1498Szrj #endif
254*38fd1498Szrj return __uninitialized_fill_n<__is_trivial(_ValueType) && __assignable>::
255*38fd1498Szrj __uninit_fill_n(__first, __n, __x);
256*38fd1498Szrj }
257*38fd1498Szrj
258*38fd1498Szrj // Extensions: versions of uninitialized_copy, uninitialized_fill,
259*38fd1498Szrj // and uninitialized_fill_n that take an allocator parameter.
260*38fd1498Szrj // We dispatch back to the standard versions when we're given the
261*38fd1498Szrj // default allocator. For nondefault allocators we do not use
262*38fd1498Szrj // any of the POD optimizations.
263*38fd1498Szrj
264*38fd1498Szrj template<typename _InputIterator, typename _ForwardIterator,
265*38fd1498Szrj typename _Allocator>
266*38fd1498Szrj _ForwardIterator
267*38fd1498Szrj __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
268*38fd1498Szrj _ForwardIterator __result, _Allocator& __alloc)
269*38fd1498Szrj {
270*38fd1498Szrj _ForwardIterator __cur = __result;
271*38fd1498Szrj __try
272*38fd1498Szrj {
273*38fd1498Szrj typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
274*38fd1498Szrj for (; __first != __last; ++__first, (void)++__cur)
275*38fd1498Szrj __traits::construct(__alloc, std::__addressof(*__cur), *__first);
276*38fd1498Szrj return __cur;
277*38fd1498Szrj }
278*38fd1498Szrj __catch(...)
279*38fd1498Szrj {
280*38fd1498Szrj std::_Destroy(__result, __cur, __alloc);
281*38fd1498Szrj __throw_exception_again;
282*38fd1498Szrj }
283*38fd1498Szrj }
284*38fd1498Szrj
285*38fd1498Szrj template<typename _InputIterator, typename _ForwardIterator, typename _Tp>
286*38fd1498Szrj inline _ForwardIterator
287*38fd1498Szrj __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
288*38fd1498Szrj _ForwardIterator __result, allocator<_Tp>&)
289*38fd1498Szrj { return std::uninitialized_copy(__first, __last, __result); }
290*38fd1498Szrj
291*38fd1498Szrj template<typename _InputIterator, typename _ForwardIterator,
292*38fd1498Szrj typename _Allocator>
293*38fd1498Szrj inline _ForwardIterator
294*38fd1498Szrj __uninitialized_move_a(_InputIterator __first, _InputIterator __last,
295*38fd1498Szrj _ForwardIterator __result, _Allocator& __alloc)
296*38fd1498Szrj {
297*38fd1498Szrj return std::__uninitialized_copy_a(_GLIBCXX_MAKE_MOVE_ITERATOR(__first),
298*38fd1498Szrj _GLIBCXX_MAKE_MOVE_ITERATOR(__last),
299*38fd1498Szrj __result, __alloc);
300*38fd1498Szrj }
301*38fd1498Szrj
302*38fd1498Szrj template<typename _InputIterator, typename _ForwardIterator,
303*38fd1498Szrj typename _Allocator>
304*38fd1498Szrj inline _ForwardIterator
305*38fd1498Szrj __uninitialized_move_if_noexcept_a(_InputIterator __first,
306*38fd1498Szrj _InputIterator __last,
307*38fd1498Szrj _ForwardIterator __result,
308*38fd1498Szrj _Allocator& __alloc)
309*38fd1498Szrj {
310*38fd1498Szrj return std::__uninitialized_copy_a
311*38fd1498Szrj (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first),
312*38fd1498Szrj _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc);
313*38fd1498Szrj }
314*38fd1498Szrj
315*38fd1498Szrj template<typename _ForwardIterator, typename _Tp, typename _Allocator>
316*38fd1498Szrj void
317*38fd1498Szrj __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
318*38fd1498Szrj const _Tp& __x, _Allocator& __alloc)
319*38fd1498Szrj {
320*38fd1498Szrj _ForwardIterator __cur = __first;
321*38fd1498Szrj __try
322*38fd1498Szrj {
323*38fd1498Szrj typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
324*38fd1498Szrj for (; __cur != __last; ++__cur)
325*38fd1498Szrj __traits::construct(__alloc, std::__addressof(*__cur), __x);
326*38fd1498Szrj }
327*38fd1498Szrj __catch(...)
328*38fd1498Szrj {
329*38fd1498Szrj std::_Destroy(__first, __cur, __alloc);
330*38fd1498Szrj __throw_exception_again;
331*38fd1498Szrj }
332*38fd1498Szrj }
333*38fd1498Szrj
334*38fd1498Szrj template<typename _ForwardIterator, typename _Tp, typename _Tp2>
335*38fd1498Szrj inline void
336*38fd1498Szrj __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
337*38fd1498Szrj const _Tp& __x, allocator<_Tp2>&)
338*38fd1498Szrj { std::uninitialized_fill(__first, __last, __x); }
339*38fd1498Szrj
340*38fd1498Szrj template<typename _ForwardIterator, typename _Size, typename _Tp,
341*38fd1498Szrj typename _Allocator>
342*38fd1498Szrj _ForwardIterator
343*38fd1498Szrj __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n,
344*38fd1498Szrj const _Tp& __x, _Allocator& __alloc)
345*38fd1498Szrj {
346*38fd1498Szrj _ForwardIterator __cur = __first;
347*38fd1498Szrj __try
348*38fd1498Szrj {
349*38fd1498Szrj typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
350*38fd1498Szrj for (; __n > 0; --__n, (void) ++__cur)
351*38fd1498Szrj __traits::construct(__alloc, std::__addressof(*__cur), __x);
352*38fd1498Szrj return __cur;
353*38fd1498Szrj }
354*38fd1498Szrj __catch(...)
355*38fd1498Szrj {
356*38fd1498Szrj std::_Destroy(__first, __cur, __alloc);
357*38fd1498Szrj __throw_exception_again;
358*38fd1498Szrj }
359*38fd1498Szrj }
360*38fd1498Szrj
361*38fd1498Szrj template<typename _ForwardIterator, typename _Size, typename _Tp,
362*38fd1498Szrj typename _Tp2>
363*38fd1498Szrj inline _ForwardIterator
364*38fd1498Szrj __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n,
365*38fd1498Szrj const _Tp& __x, allocator<_Tp2>&)
366*38fd1498Szrj { return std::uninitialized_fill_n(__first, __n, __x); }
367*38fd1498Szrj
368*38fd1498Szrj
369*38fd1498Szrj // Extensions: __uninitialized_copy_move, __uninitialized_move_copy,
370*38fd1498Szrj // __uninitialized_fill_move, __uninitialized_move_fill.
371*38fd1498Szrj // All of these algorithms take a user-supplied allocator, which is used
372*38fd1498Szrj // for construction and destruction.
373*38fd1498Szrj
374*38fd1498Szrj // __uninitialized_copy_move
375*38fd1498Szrj // Copies [first1, last1) into [result, result + (last1 - first1)), and
376*38fd1498Szrj // move [first2, last2) into
377*38fd1498Szrj // [result, result + (last1 - first1) + (last2 - first2)).
378*38fd1498Szrj template<typename _InputIterator1, typename _InputIterator2,
379*38fd1498Szrj typename _ForwardIterator, typename _Allocator>
380*38fd1498Szrj inline _ForwardIterator
381*38fd1498Szrj __uninitialized_copy_move(_InputIterator1 __first1,
382*38fd1498Szrj _InputIterator1 __last1,
383*38fd1498Szrj _InputIterator2 __first2,
384*38fd1498Szrj _InputIterator2 __last2,
385*38fd1498Szrj _ForwardIterator __result,
386*38fd1498Szrj _Allocator& __alloc)
387*38fd1498Szrj {
388*38fd1498Szrj _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1,
389*38fd1498Szrj __result,
390*38fd1498Szrj __alloc);
391*38fd1498Szrj __try
392*38fd1498Szrj {
393*38fd1498Szrj return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc);
394*38fd1498Szrj }
395*38fd1498Szrj __catch(...)
396*38fd1498Szrj {
397*38fd1498Szrj std::_Destroy(__result, __mid, __alloc);
398*38fd1498Szrj __throw_exception_again;
399*38fd1498Szrj }
400*38fd1498Szrj }
401*38fd1498Szrj
402*38fd1498Szrj // __uninitialized_move_copy
403*38fd1498Szrj // Moves [first1, last1) into [result, result + (last1 - first1)), and
404*38fd1498Szrj // copies [first2, last2) into
405*38fd1498Szrj // [result, result + (last1 - first1) + (last2 - first2)).
406*38fd1498Szrj template<typename _InputIterator1, typename _InputIterator2,
407*38fd1498Szrj typename _ForwardIterator, typename _Allocator>
408*38fd1498Szrj inline _ForwardIterator
409*38fd1498Szrj __uninitialized_move_copy(_InputIterator1 __first1,
410*38fd1498Szrj _InputIterator1 __last1,
411*38fd1498Szrj _InputIterator2 __first2,
412*38fd1498Szrj _InputIterator2 __last2,
413*38fd1498Szrj _ForwardIterator __result,
414*38fd1498Szrj _Allocator& __alloc)
415*38fd1498Szrj {
416*38fd1498Szrj _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1,
417*38fd1498Szrj __result,
418*38fd1498Szrj __alloc);
419*38fd1498Szrj __try
420*38fd1498Szrj {
421*38fd1498Szrj return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);
422*38fd1498Szrj }
423*38fd1498Szrj __catch(...)
424*38fd1498Szrj {
425*38fd1498Szrj std::_Destroy(__result, __mid, __alloc);
426*38fd1498Szrj __throw_exception_again;
427*38fd1498Szrj }
428*38fd1498Szrj }
429*38fd1498Szrj
430*38fd1498Szrj // __uninitialized_fill_move
431*38fd1498Szrj // Fills [result, mid) with x, and moves [first, last) into
432*38fd1498Szrj // [mid, mid + (last - first)).
433*38fd1498Szrj template<typename _ForwardIterator, typename _Tp, typename _InputIterator,
434*38fd1498Szrj typename _Allocator>
435*38fd1498Szrj inline _ForwardIterator
436*38fd1498Szrj __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid,
437*38fd1498Szrj const _Tp& __x, _InputIterator __first,
438*38fd1498Szrj _InputIterator __last, _Allocator& __alloc)
439*38fd1498Szrj {
440*38fd1498Szrj std::__uninitialized_fill_a(__result, __mid, __x, __alloc);
441*38fd1498Szrj __try
442*38fd1498Szrj {
443*38fd1498Szrj return std::__uninitialized_move_a(__first, __last, __mid, __alloc);
444*38fd1498Szrj }
445*38fd1498Szrj __catch(...)
446*38fd1498Szrj {
447*38fd1498Szrj std::_Destroy(__result, __mid, __alloc);
448*38fd1498Szrj __throw_exception_again;
449*38fd1498Szrj }
450*38fd1498Szrj }
451*38fd1498Szrj
452*38fd1498Szrj // __uninitialized_move_fill
453*38fd1498Szrj // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and
454*38fd1498Szrj // fills [first2 + (last1 - first1), last2) with x.
455*38fd1498Szrj template<typename _InputIterator, typename _ForwardIterator, typename _Tp,
456*38fd1498Szrj typename _Allocator>
457*38fd1498Szrj inline void
458*38fd1498Szrj __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1,
459*38fd1498Szrj _ForwardIterator __first2,
460*38fd1498Szrj _ForwardIterator __last2, const _Tp& __x,
461*38fd1498Szrj _Allocator& __alloc)
462*38fd1498Szrj {
463*38fd1498Szrj _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1,
464*38fd1498Szrj __first2,
465*38fd1498Szrj __alloc);
466*38fd1498Szrj __try
467*38fd1498Szrj {
468*38fd1498Szrj std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc);
469*38fd1498Szrj }
470*38fd1498Szrj __catch(...)
471*38fd1498Szrj {
472*38fd1498Szrj std::_Destroy(__first2, __mid2, __alloc);
473*38fd1498Szrj __throw_exception_again;
474*38fd1498Szrj }
475*38fd1498Szrj }
476*38fd1498Szrj
477*38fd1498Szrj #if __cplusplus >= 201103L
478*38fd1498Szrj // Extensions: __uninitialized_default, __uninitialized_default_n,
479*38fd1498Szrj // __uninitialized_default_a, __uninitialized_default_n_a.
480*38fd1498Szrj
481*38fd1498Szrj template<bool _TrivialValueType>
482*38fd1498Szrj struct __uninitialized_default_1
483*38fd1498Szrj {
484*38fd1498Szrj template<typename _ForwardIterator>
485*38fd1498Szrj static void
486*38fd1498Szrj __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
487*38fd1498Szrj {
488*38fd1498Szrj _ForwardIterator __cur = __first;
489*38fd1498Szrj __try
490*38fd1498Szrj {
491*38fd1498Szrj for (; __cur != __last; ++__cur)
492*38fd1498Szrj std::_Construct(std::__addressof(*__cur));
493*38fd1498Szrj }
494*38fd1498Szrj __catch(...)
495*38fd1498Szrj {
496*38fd1498Szrj std::_Destroy(__first, __cur);
497*38fd1498Szrj __throw_exception_again;
498*38fd1498Szrj }
499*38fd1498Szrj }
500*38fd1498Szrj };
501*38fd1498Szrj
502*38fd1498Szrj template<>
503*38fd1498Szrj struct __uninitialized_default_1<true>
504*38fd1498Szrj {
505*38fd1498Szrj template<typename _ForwardIterator>
506*38fd1498Szrj static void
507*38fd1498Szrj __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
508*38fd1498Szrj {
509*38fd1498Szrj typedef typename iterator_traits<_ForwardIterator>::value_type
510*38fd1498Szrj _ValueType;
511*38fd1498Szrj
512*38fd1498Szrj std::fill(__first, __last, _ValueType());
513*38fd1498Szrj }
514*38fd1498Szrj };
515*38fd1498Szrj
516*38fd1498Szrj template<bool _TrivialValueType>
517*38fd1498Szrj struct __uninitialized_default_n_1
518*38fd1498Szrj {
519*38fd1498Szrj template<typename _ForwardIterator, typename _Size>
520*38fd1498Szrj static _ForwardIterator
521*38fd1498Szrj __uninit_default_n(_ForwardIterator __first, _Size __n)
522*38fd1498Szrj {
523*38fd1498Szrj _ForwardIterator __cur = __first;
524*38fd1498Szrj __try
525*38fd1498Szrj {
526*38fd1498Szrj for (; __n > 0; --__n, (void) ++__cur)
527*38fd1498Szrj std::_Construct(std::__addressof(*__cur));
528*38fd1498Szrj return __cur;
529*38fd1498Szrj }
530*38fd1498Szrj __catch(...)
531*38fd1498Szrj {
532*38fd1498Szrj std::_Destroy(__first, __cur);
533*38fd1498Szrj __throw_exception_again;
534*38fd1498Szrj }
535*38fd1498Szrj }
536*38fd1498Szrj };
537*38fd1498Szrj
538*38fd1498Szrj template<>
539*38fd1498Szrj struct __uninitialized_default_n_1<true>
540*38fd1498Szrj {
541*38fd1498Szrj template<typename _ForwardIterator, typename _Size>
542*38fd1498Szrj static _ForwardIterator
543*38fd1498Szrj __uninit_default_n(_ForwardIterator __first, _Size __n)
544*38fd1498Szrj {
545*38fd1498Szrj typedef typename iterator_traits<_ForwardIterator>::value_type
546*38fd1498Szrj _ValueType;
547*38fd1498Szrj
548*38fd1498Szrj return std::fill_n(__first, __n, _ValueType());
549*38fd1498Szrj }
550*38fd1498Szrj };
551*38fd1498Szrj
552*38fd1498Szrj // __uninitialized_default
553*38fd1498Szrj // Fills [first, last) with std::distance(first, last) default
554*38fd1498Szrj // constructed value_types(s).
555*38fd1498Szrj template<typename _ForwardIterator>
556*38fd1498Szrj inline void
557*38fd1498Szrj __uninitialized_default(_ForwardIterator __first,
558*38fd1498Szrj _ForwardIterator __last)
559*38fd1498Szrj {
560*38fd1498Szrj typedef typename iterator_traits<_ForwardIterator>::value_type
561*38fd1498Szrj _ValueType;
562*38fd1498Szrj // trivial types can have deleted assignment
563*38fd1498Szrj const bool __assignable = is_copy_assignable<_ValueType>::value;
564*38fd1498Szrj
565*38fd1498Szrj std::__uninitialized_default_1<__is_trivial(_ValueType)
566*38fd1498Szrj && __assignable>::
567*38fd1498Szrj __uninit_default(__first, __last);
568*38fd1498Szrj }
569*38fd1498Szrj
570*38fd1498Szrj // __uninitialized_default_n
571*38fd1498Szrj // Fills [first, first + n) with n default constructed value_type(s).
572*38fd1498Szrj template<typename _ForwardIterator, typename _Size>
573*38fd1498Szrj inline _ForwardIterator
574*38fd1498Szrj __uninitialized_default_n(_ForwardIterator __first, _Size __n)
575*38fd1498Szrj {
576*38fd1498Szrj typedef typename iterator_traits<_ForwardIterator>::value_type
577*38fd1498Szrj _ValueType;
578*38fd1498Szrj // trivial types can have deleted assignment
579*38fd1498Szrj const bool __assignable = is_copy_assignable<_ValueType>::value;
580*38fd1498Szrj
581*38fd1498Szrj return __uninitialized_default_n_1<__is_trivial(_ValueType)
582*38fd1498Szrj && __assignable>::
583*38fd1498Szrj __uninit_default_n(__first, __n);
584*38fd1498Szrj }
585*38fd1498Szrj
586*38fd1498Szrj
587*38fd1498Szrj // __uninitialized_default_a
588*38fd1498Szrj // Fills [first, last) with std::distance(first, last) default
589*38fd1498Szrj // constructed value_types(s), constructed with the allocator alloc.
590*38fd1498Szrj template<typename _ForwardIterator, typename _Allocator>
591*38fd1498Szrj void
592*38fd1498Szrj __uninitialized_default_a(_ForwardIterator __first,
593*38fd1498Szrj _ForwardIterator __last,
594*38fd1498Szrj _Allocator& __alloc)
595*38fd1498Szrj {
596*38fd1498Szrj _ForwardIterator __cur = __first;
597*38fd1498Szrj __try
598*38fd1498Szrj {
599*38fd1498Szrj typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
600*38fd1498Szrj for (; __cur != __last; ++__cur)
601*38fd1498Szrj __traits::construct(__alloc, std::__addressof(*__cur));
602*38fd1498Szrj }
603*38fd1498Szrj __catch(...)
604*38fd1498Szrj {
605*38fd1498Szrj std::_Destroy(__first, __cur, __alloc);
606*38fd1498Szrj __throw_exception_again;
607*38fd1498Szrj }
608*38fd1498Szrj }
609*38fd1498Szrj
610*38fd1498Szrj template<typename _ForwardIterator, typename _Tp>
611*38fd1498Szrj inline void
612*38fd1498Szrj __uninitialized_default_a(_ForwardIterator __first,
613*38fd1498Szrj _ForwardIterator __last,
614*38fd1498Szrj allocator<_Tp>&)
615*38fd1498Szrj { std::__uninitialized_default(__first, __last); }
616*38fd1498Szrj
617*38fd1498Szrj
618*38fd1498Szrj // __uninitialized_default_n_a
619*38fd1498Szrj // Fills [first, first + n) with n default constructed value_types(s),
620*38fd1498Szrj // constructed with the allocator alloc.
621*38fd1498Szrj template<typename _ForwardIterator, typename _Size, typename _Allocator>
622*38fd1498Szrj _ForwardIterator
623*38fd1498Szrj __uninitialized_default_n_a(_ForwardIterator __first, _Size __n,
624*38fd1498Szrj _Allocator& __alloc)
625*38fd1498Szrj {
626*38fd1498Szrj _ForwardIterator __cur = __first;
627*38fd1498Szrj __try
628*38fd1498Szrj {
629*38fd1498Szrj typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
630*38fd1498Szrj for (; __n > 0; --__n, (void) ++__cur)
631*38fd1498Szrj __traits::construct(__alloc, std::__addressof(*__cur));
632*38fd1498Szrj return __cur;
633*38fd1498Szrj }
634*38fd1498Szrj __catch(...)
635*38fd1498Szrj {
636*38fd1498Szrj std::_Destroy(__first, __cur, __alloc);
637*38fd1498Szrj __throw_exception_again;
638*38fd1498Szrj }
639*38fd1498Szrj }
640*38fd1498Szrj
641*38fd1498Szrj template<typename _ForwardIterator, typename _Size, typename _Tp>
642*38fd1498Szrj inline _ForwardIterator
643*38fd1498Szrj __uninitialized_default_n_a(_ForwardIterator __first, _Size __n,
644*38fd1498Szrj allocator<_Tp>&)
645*38fd1498Szrj { return std::__uninitialized_default_n(__first, __n); }
646*38fd1498Szrj
647*38fd1498Szrj template<bool _TrivialValueType>
648*38fd1498Szrj struct __uninitialized_default_novalue_1
649*38fd1498Szrj {
650*38fd1498Szrj template<typename _ForwardIterator>
651*38fd1498Szrj static void
652*38fd1498Szrj __uninit_default_novalue(_ForwardIterator __first,
653*38fd1498Szrj _ForwardIterator __last)
654*38fd1498Szrj {
655*38fd1498Szrj _ForwardIterator __cur = __first;
656*38fd1498Szrj __try
657*38fd1498Szrj {
658*38fd1498Szrj for (; __cur != __last; ++__cur)
659*38fd1498Szrj std::_Construct_novalue(std::__addressof(*__cur));
660*38fd1498Szrj }
661*38fd1498Szrj __catch(...)
662*38fd1498Szrj {
663*38fd1498Szrj std::_Destroy(__first, __cur);
664*38fd1498Szrj __throw_exception_again;
665*38fd1498Szrj }
666*38fd1498Szrj }
667*38fd1498Szrj };
668*38fd1498Szrj
669*38fd1498Szrj template<>
670*38fd1498Szrj struct __uninitialized_default_novalue_1<true>
671*38fd1498Szrj {
672*38fd1498Szrj template<typename _ForwardIterator>
673*38fd1498Szrj static void
674*38fd1498Szrj __uninit_default_novalue(_ForwardIterator __first,
675*38fd1498Szrj _ForwardIterator __last)
676*38fd1498Szrj {
677*38fd1498Szrj }
678*38fd1498Szrj };
679*38fd1498Szrj
680*38fd1498Szrj template<bool _TrivialValueType>
681*38fd1498Szrj struct __uninitialized_default_novalue_n_1
682*38fd1498Szrj {
683*38fd1498Szrj template<typename _ForwardIterator, typename _Size>
684*38fd1498Szrj static _ForwardIterator
685*38fd1498Szrj __uninit_default_novalue_n(_ForwardIterator __first, _Size __n)
686*38fd1498Szrj {
687*38fd1498Szrj _ForwardIterator __cur = __first;
688*38fd1498Szrj __try
689*38fd1498Szrj {
690*38fd1498Szrj for (; __n > 0; --__n, (void) ++__cur)
691*38fd1498Szrj std::_Construct_novalue(std::__addressof(*__cur));
692*38fd1498Szrj return __cur;
693*38fd1498Szrj }
694*38fd1498Szrj __catch(...)
695*38fd1498Szrj {
696*38fd1498Szrj std::_Destroy(__first, __cur);
697*38fd1498Szrj __throw_exception_again;
698*38fd1498Szrj }
699*38fd1498Szrj }
700*38fd1498Szrj };
701*38fd1498Szrj
702*38fd1498Szrj template<>
703*38fd1498Szrj struct __uninitialized_default_novalue_n_1<true>
704*38fd1498Szrj {
705*38fd1498Szrj template<typename _ForwardIterator, typename _Size>
706*38fd1498Szrj static _ForwardIterator
707*38fd1498Szrj __uninit_default_novalue_n(_ForwardIterator __first, _Size __n)
708*38fd1498Szrj { return std::next(__first, __n); }
709*38fd1498Szrj };
710*38fd1498Szrj
711*38fd1498Szrj // __uninitialized_default_novalue
712*38fd1498Szrj // Fills [first, last) with std::distance(first, last) default-initialized
713*38fd1498Szrj // value_types(s).
714*38fd1498Szrj template<typename _ForwardIterator>
715*38fd1498Szrj inline void
716*38fd1498Szrj __uninitialized_default_novalue(_ForwardIterator __first,
717*38fd1498Szrj _ForwardIterator __last)
718*38fd1498Szrj {
719*38fd1498Szrj typedef typename iterator_traits<_ForwardIterator>::value_type
720*38fd1498Szrj _ValueType;
721*38fd1498Szrj
722*38fd1498Szrj std::__uninitialized_default_novalue_1<
723*38fd1498Szrj is_trivially_default_constructible<_ValueType>::value>::
724*38fd1498Szrj __uninit_default_novalue(__first, __last);
725*38fd1498Szrj }
726*38fd1498Szrj
727*38fd1498Szrj // __uninitialized_default_n
728*38fd1498Szrj // Fills [first, first + n) with n default-initialized value_type(s).
729*38fd1498Szrj template<typename _ForwardIterator, typename _Size>
730*38fd1498Szrj inline _ForwardIterator
731*38fd1498Szrj __uninitialized_default_novalue_n(_ForwardIterator __first, _Size __n)
732*38fd1498Szrj {
733*38fd1498Szrj typedef typename iterator_traits<_ForwardIterator>::value_type
734*38fd1498Szrj _ValueType;
735*38fd1498Szrj
736*38fd1498Szrj return __uninitialized_default_novalue_n_1<
737*38fd1498Szrj is_trivially_default_constructible<_ValueType>::value>::
738*38fd1498Szrj __uninit_default_novalue_n(__first, __n);
739*38fd1498Szrj }
740*38fd1498Szrj
741*38fd1498Szrj template<typename _InputIterator, typename _Size,
742*38fd1498Szrj typename _ForwardIterator>
743*38fd1498Szrj _ForwardIterator
744*38fd1498Szrj __uninitialized_copy_n(_InputIterator __first, _Size __n,
745*38fd1498Szrj _ForwardIterator __result, input_iterator_tag)
746*38fd1498Szrj {
747*38fd1498Szrj _ForwardIterator __cur = __result;
748*38fd1498Szrj __try
749*38fd1498Szrj {
750*38fd1498Szrj for (; __n > 0; --__n, (void) ++__first, ++__cur)
751*38fd1498Szrj std::_Construct(std::__addressof(*__cur), *__first);
752*38fd1498Szrj return __cur;
753*38fd1498Szrj }
754*38fd1498Szrj __catch(...)
755*38fd1498Szrj {
756*38fd1498Szrj std::_Destroy(__result, __cur);
757*38fd1498Szrj __throw_exception_again;
758*38fd1498Szrj }
759*38fd1498Szrj }
760*38fd1498Szrj
761*38fd1498Szrj template<typename _RandomAccessIterator, typename _Size,
762*38fd1498Szrj typename _ForwardIterator>
763*38fd1498Szrj inline _ForwardIterator
764*38fd1498Szrj __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n,
765*38fd1498Szrj _ForwardIterator __result,
766*38fd1498Szrj random_access_iterator_tag)
767*38fd1498Szrj { return std::uninitialized_copy(__first, __first + __n, __result); }
768*38fd1498Szrj
769*38fd1498Szrj template<typename _InputIterator, typename _Size,
770*38fd1498Szrj typename _ForwardIterator>
771*38fd1498Szrj pair<_InputIterator, _ForwardIterator>
772*38fd1498Szrj __uninitialized_copy_n_pair(_InputIterator __first, _Size __n,
773*38fd1498Szrj _ForwardIterator __result, input_iterator_tag)
774*38fd1498Szrj {
775*38fd1498Szrj _ForwardIterator __cur = __result;
776*38fd1498Szrj __try
777*38fd1498Szrj {
778*38fd1498Szrj for (; __n > 0; --__n, (void) ++__first, ++__cur)
779*38fd1498Szrj std::_Construct(std::__addressof(*__cur), *__first);
780*38fd1498Szrj return {__first, __cur};
781*38fd1498Szrj }
782*38fd1498Szrj __catch(...)
783*38fd1498Szrj {
784*38fd1498Szrj std::_Destroy(__result, __cur);
785*38fd1498Szrj __throw_exception_again;
786*38fd1498Szrj }
787*38fd1498Szrj }
788*38fd1498Szrj
789*38fd1498Szrj template<typename _RandomAccessIterator, typename _Size,
790*38fd1498Szrj typename _ForwardIterator>
791*38fd1498Szrj inline pair<_RandomAccessIterator, _ForwardIterator>
792*38fd1498Szrj __uninitialized_copy_n_pair(_RandomAccessIterator __first, _Size __n,
793*38fd1498Szrj _ForwardIterator __result,
794*38fd1498Szrj random_access_iterator_tag)
795*38fd1498Szrj {
796*38fd1498Szrj auto __second_res = uninitialized_copy(__first, __first + __n, __result);
797*38fd1498Szrj auto __first_res = std::next(__first, __n);
798*38fd1498Szrj return {__first_res, __second_res};
799*38fd1498Szrj }
800*38fd1498Szrj
801*38fd1498Szrj /**
802*38fd1498Szrj * @brief Copies the range [first,first+n) into result.
803*38fd1498Szrj * @param __first An input iterator.
804*38fd1498Szrj * @param __n The number of elements to copy.
805*38fd1498Szrj * @param __result An output iterator.
806*38fd1498Szrj * @return __result + __n
807*38fd1498Szrj *
808*38fd1498Szrj * Like copy_n(), but does not require an initialized output range.
809*38fd1498Szrj */
810*38fd1498Szrj template<typename _InputIterator, typename _Size, typename _ForwardIterator>
811*38fd1498Szrj inline _ForwardIterator
812*38fd1498Szrj uninitialized_copy_n(_InputIterator __first, _Size __n,
813*38fd1498Szrj _ForwardIterator __result)
814*38fd1498Szrj { return std::__uninitialized_copy_n(__first, __n, __result,
815*38fd1498Szrj std::__iterator_category(__first)); }
816*38fd1498Szrj
817*38fd1498Szrj template<typename _InputIterator, typename _Size, typename _ForwardIterator>
818*38fd1498Szrj inline pair<_InputIterator, _ForwardIterator>
819*38fd1498Szrj __uninitialized_copy_n_pair(_InputIterator __first, _Size __n,
820*38fd1498Szrj _ForwardIterator __result)
821*38fd1498Szrj {
822*38fd1498Szrj return
823*38fd1498Szrj std::__uninitialized_copy_n_pair(__first, __n, __result,
824*38fd1498Szrj std::__iterator_category(__first));
825*38fd1498Szrj }
826*38fd1498Szrj
827*38fd1498Szrj #endif
828*38fd1498Szrj
829*38fd1498Szrj #if __cplusplus > 201402L
830*38fd1498Szrj template <typename _ForwardIterator>
831*38fd1498Szrj inline void
832*38fd1498Szrj uninitialized_default_construct(_ForwardIterator __first,
833*38fd1498Szrj _ForwardIterator __last)
834*38fd1498Szrj {
835*38fd1498Szrj __uninitialized_default_novalue(__first, __last);
836*38fd1498Szrj }
837*38fd1498Szrj
838*38fd1498Szrj template <typename _ForwardIterator, typename _Size>
839*38fd1498Szrj inline _ForwardIterator
840*38fd1498Szrj uninitialized_default_construct_n(_ForwardIterator __first, _Size __count)
841*38fd1498Szrj {
842*38fd1498Szrj return __uninitialized_default_novalue_n(__first, __count);
843*38fd1498Szrj }
844*38fd1498Szrj
845*38fd1498Szrj template <typename _ForwardIterator>
846*38fd1498Szrj inline void
847*38fd1498Szrj uninitialized_value_construct(_ForwardIterator __first,
848*38fd1498Szrj _ForwardIterator __last)
849*38fd1498Szrj {
850*38fd1498Szrj return __uninitialized_default(__first, __last);
851*38fd1498Szrj }
852*38fd1498Szrj
853*38fd1498Szrj template <typename _ForwardIterator, typename _Size>
854*38fd1498Szrj inline _ForwardIterator
855*38fd1498Szrj uninitialized_value_construct_n(_ForwardIterator __first, _Size __count)
856*38fd1498Szrj {
857*38fd1498Szrj return __uninitialized_default_n(__first, __count);
858*38fd1498Szrj }
859*38fd1498Szrj
860*38fd1498Szrj template <typename _InputIterator, typename _ForwardIterator>
861*38fd1498Szrj inline _ForwardIterator
862*38fd1498Szrj uninitialized_move(_InputIterator __first, _InputIterator __last,
863*38fd1498Szrj _ForwardIterator __result)
864*38fd1498Szrj {
865*38fd1498Szrj return std::uninitialized_copy
866*38fd1498Szrj (_GLIBCXX_MAKE_MOVE_ITERATOR(__first),
867*38fd1498Szrj _GLIBCXX_MAKE_MOVE_ITERATOR(__last), __result);
868*38fd1498Szrj }
869*38fd1498Szrj
870*38fd1498Szrj template <typename _InputIterator, typename _Size, typename _ForwardIterator>
871*38fd1498Szrj inline pair<_InputIterator, _ForwardIterator>
872*38fd1498Szrj uninitialized_move_n(_InputIterator __first, _Size __count,
873*38fd1498Szrj _ForwardIterator __result)
874*38fd1498Szrj {
875*38fd1498Szrj auto __res = std::__uninitialized_copy_n_pair
876*38fd1498Szrj (_GLIBCXX_MAKE_MOVE_ITERATOR(__first),
877*38fd1498Szrj __count, __result);
878*38fd1498Szrj return {__res.first.base(), __res.second};
879*38fd1498Szrj }
880*38fd1498Szrj #endif
881*38fd1498Szrj
882*38fd1498Szrj _GLIBCXX_END_NAMESPACE_VERSION
883*38fd1498Szrj } // namespace
884*38fd1498Szrj
885*38fd1498Szrj #endif /* _STL_UNINITIALIZED_H */
886