libstdc++
ranges_uninitialized.h
Go to the documentation of this file.
1// Raw memory manipulators -*- C++ -*-
2
3// Copyright (C) 2020-2025 Free Software Foundation, Inc.
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
19
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
24
25/** @file bits/ranges_uninitialized.h
26 * This is an internal header file, included by other library headers.
27 * Do not attempt to use it directly. @headername{memory}
28 */
29
30#ifndef _RANGES_UNINITIALIZED_H
31#define _RANGES_UNINITIALIZED_H 1
32
33#if __cplusplus > 201703L
34#if __cpp_lib_concepts
35
37
38namespace std _GLIBCXX_VISIBILITY(default)
39{
40_GLIBCXX_BEGIN_NAMESPACE_VERSION
41namespace ranges
42{
43 namespace __detail
44 {
45 template<typename _Tp>
46 constexpr void*
47 __voidify(_Tp& __obj) noexcept
48 {
49 return const_cast<void*>
50 (static_cast<const volatile void*>(std::__addressof(__obj)));
51 }
52
53 template<typename _Iter>
54 concept __nothrow_input_iterator
55 = (input_iterator<_Iter>
56 && is_lvalue_reference_v<iter_reference_t<_Iter>>
57 && same_as<remove_cvref_t<iter_reference_t<_Iter>>,
58 iter_value_t<_Iter>>);
59
60 template<typename _Sent, typename _Iter>
61 concept __nothrow_sentinel = sentinel_for<_Sent, _Iter>;
62
63 template<typename _Range>
64 concept __nothrow_input_range
65 = (range<_Range>
66 && __nothrow_input_iterator<iterator_t<_Range>>
67 && __nothrow_sentinel<sentinel_t<_Range>, iterator_t<_Range>>);
68
69 template<typename _Iter>
70 concept __nothrow_forward_iterator
71 = (__nothrow_input_iterator<_Iter>
72 && forward_iterator<_Iter>
73 && __nothrow_sentinel<_Iter, _Iter>);
74
75 template<typename _Range>
76 concept __nothrow_forward_range
77 = (__nothrow_input_range<_Range>
78 && __nothrow_forward_iterator<iterator_t<_Range>>);
79 } // namespace __detail
80
81 struct __destroy_fn
82 {
83 template<__detail::__nothrow_input_iterator _Iter,
84 __detail::__nothrow_sentinel<_Iter> _Sent>
85 requires destructible<iter_value_t<_Iter>>
86 constexpr _Iter
87 operator()(_Iter __first, _Sent __last) const noexcept;
88
89 template<__detail::__nothrow_input_range _Range>
90 requires destructible<range_value_t<_Range>>
91 constexpr borrowed_iterator_t<_Range>
92 operator()(_Range&& __r) const noexcept;
93 };
94
95 inline constexpr __destroy_fn destroy{};
96
97 namespace __detail
98 {
99 template<typename _Iter>
100 requires destructible<iter_value_t<_Iter>>
101 struct _DestroyGuard
102 {
103 private:
104 _Iter _M_first;
105 const _Iter* _M_cur;
106
107 public:
108 constexpr
109 explicit
110 _DestroyGuard(const _Iter& __iter)
111 : _M_first(__iter), _M_cur(std::__addressof(__iter))
112 { }
113
114 constexpr
115 void
116 release() noexcept
117 { _M_cur = nullptr; }
118
119 constexpr
120 ~_DestroyGuard()
121 {
122 if (_M_cur != nullptr)
123 ranges::destroy(std::move(_M_first), *_M_cur);
124 }
125 };
126
127 template<typename _Iter>
128 requires destructible<iter_value_t<_Iter>>
129 && is_trivially_destructible_v<iter_value_t<_Iter>>
130 struct _DestroyGuard<_Iter>
131 {
132 constexpr
133 explicit
134 _DestroyGuard(const _Iter&)
135 { }
136
137 constexpr
138 void
139 release() noexcept
140 { }
141 };
142 } // namespace __detail
143
144 struct __uninitialized_default_construct_fn
145 {
146 template<__detail::__nothrow_forward_iterator _Iter,
147 __detail::__nothrow_sentinel<_Iter> _Sent>
148 requires default_initializable<iter_value_t<_Iter>>
149 _GLIBCXX26_CONSTEXPR
150 _Iter
151 operator()(_Iter __first, _Sent __last) const
152 {
153 using _ValueType = remove_reference_t<iter_reference_t<_Iter>>;
154 if constexpr (is_trivially_default_constructible_v<_ValueType>)
155 return ranges::next(__first, __last);
156 else
157 {
158 auto __guard = __detail::_DestroyGuard(__first);
159 for (; __first != __last; ++__first)
160 ::new (__detail::__voidify(*__first)) _ValueType;
161 __guard.release();
162 return __first;
163 }
164 }
165
166 template<__detail::__nothrow_forward_range _Range>
167 requires default_initializable<range_value_t<_Range>>
168 _GLIBCXX26_CONSTEXPR
169 borrowed_iterator_t<_Range>
170 operator()(_Range&& __r) const
171 {
172 return (*this)(ranges::begin(__r), ranges::end(__r));
173 }
174 };
175
176 inline constexpr __uninitialized_default_construct_fn
178
179 struct __uninitialized_default_construct_n_fn
180 {
181 template<__detail::__nothrow_forward_iterator _Iter>
182 requires default_initializable<iter_value_t<_Iter>>
183 _GLIBCXX26_CONSTEXPR
184 _Iter
185 operator()(_Iter __first, iter_difference_t<_Iter> __n) const
186 {
187 using _ValueType = remove_reference_t<iter_reference_t<_Iter>>;
188 if constexpr (is_trivially_default_constructible_v<_ValueType>)
189 return ranges::next(__first, __n);
190 else
191 {
192 auto __guard = __detail::_DestroyGuard(__first);
193 for (; __n > 0; ++__first, (void) --__n)
194 ::new (__detail::__voidify(*__first)) _ValueType;
195 __guard.release();
196 return __first;
197 }
198 }
199 };
200
201 inline constexpr __uninitialized_default_construct_n_fn
203
204 struct __uninitialized_value_construct_fn
205 {
206 template<__detail::__nothrow_forward_iterator _Iter,
207 __detail::__nothrow_sentinel<_Iter> _Sent>
208 requires default_initializable<iter_value_t<_Iter>>
209 _GLIBCXX26_CONSTEXPR
210 _Iter
211 operator()(_Iter __first, _Sent __last) const
212 {
213 using _ValueType = remove_reference_t<iter_reference_t<_Iter>>;
214 if constexpr (is_trivially_default_constructible_v<_ValueType>
215 && is_trivially_copy_assignable_v<_ValueType>)
216 return ranges::fill(__first, __last, _ValueType());
217 else
218 {
219 auto __guard = __detail::_DestroyGuard(__first);
220 for (; __first != __last; ++__first)
221 ::new (__detail::__voidify(*__first)) _ValueType();
222 __guard.release();
223 return __first;
224 }
225 }
226
227 template<__detail::__nothrow_forward_range _Range>
228 requires default_initializable<range_value_t<_Range>>
229 _GLIBCXX26_CONSTEXPR
230 borrowed_iterator_t<_Range>
231 operator()(_Range&& __r) const
232 {
233 return (*this)(ranges::begin(__r), ranges::end(__r));
234 }
235 };
236
237 inline constexpr __uninitialized_value_construct_fn
239
240 struct __uninitialized_value_construct_n_fn
241 {
242 template<__detail::__nothrow_forward_iterator _Iter>
243 requires default_initializable<iter_value_t<_Iter>>
244 _GLIBCXX26_CONSTEXPR
245 _Iter
246 operator()(_Iter __first, iter_difference_t<_Iter> __n) const
247 {
248 using _ValueType = remove_reference_t<iter_reference_t<_Iter>>;
249 if constexpr (is_trivially_default_constructible_v<_ValueType>
250 && is_trivially_copy_assignable_v<_ValueType>)
251 return ranges::fill_n(__first, __n, _ValueType());
252 else
253 {
254 auto __guard = __detail::_DestroyGuard(__first);
255 for (; __n > 0; ++__first, (void) --__n)
256 ::new (__detail::__voidify(*__first)) _ValueType();
257 __guard.release();
258 return __first;
259 }
260 }
261 };
262
263 inline constexpr __uninitialized_value_construct_n_fn
265
266 namespace __detail
267 {
268 // This is only intended for finding smaller iterator differences below,
269 // not as a general purpose replacement for std::min.
270 struct __mindist_fn
271 {
272 template<typename _Dp1, typename _Dp2>
273 constexpr common_type_t<_Dp1, _Dp2>
274 operator()(_Dp1 __d1, _Dp2 __d2) const noexcept
275 {
276 // Every C++20 iterator I satisfies weakly_incrementable<I> which
277 // requires signed-integer-like<iter_difference_t<I>>.
278 static_assert(std::__detail::__is_signed_integer_like<_Dp1>);
279 static_assert(std::__detail::__is_signed_integer_like<_Dp2>);
280 return std::min<common_type_t<_Dp1, _Dp2>>(__d1, __d2);
281 }
282 };
283 inline constexpr __mindist_fn __mindist{};
284 }
285
286 template<typename _Iter, typename _Out>
287 using uninitialized_copy_result = in_out_result<_Iter, _Out>;
288
289 struct __uninitialized_copy_fn
290 {
291 template<input_iterator _Iter, sentinel_for<_Iter> _ISent,
292 __detail::__nothrow_forward_iterator _Out,
293 __detail::__nothrow_sentinel<_Out> _OSent>
294 requires constructible_from<iter_value_t<_Out>, iter_reference_t<_Iter>>
295 _GLIBCXX26_CONSTEXPR
296 uninitialized_copy_result<_Iter, _Out>
297 operator()(_Iter __ifirst, _ISent __ilast,
298 _Out __ofirst, _OSent __olast) const
299 {
300 using _OutType = remove_reference_t<iter_reference_t<_Out>>;
301 if constexpr (sized_sentinel_for<_ISent, _Iter>
302 && sized_sentinel_for<_OSent, _Out>
303 && is_trivially_constructible_v<_OutType, iter_reference_t<_Iter>>
304 && is_trivially_default_constructible_v<_OutType>
305 && is_trivially_assignable_v<_OutType&,
306 iter_reference_t<_Iter>>)
307 {
308 auto __d1 = __ilast - __ifirst;
309 auto __d2 = __olast - __ofirst;
310 return ranges::copy_n(std::move(__ifirst),
311 __detail::__mindist(__d1, __d2), __ofirst);
312 }
313 else
314 {
315 auto __guard = __detail::_DestroyGuard(__ofirst);
316 for (; __ifirst != __ilast && __ofirst != __olast;
317 ++__ofirst, (void)++__ifirst)
318 ::new (__detail::__voidify(*__ofirst)) _OutType(*__ifirst);
319 __guard.release();
320 return {std::move(__ifirst), __ofirst};
321 }
322 }
323
324 template<input_range _IRange, __detail::__nothrow_forward_range _ORange>
325 requires constructible_from<range_value_t<_ORange>,
326 range_reference_t<_IRange>>
327 _GLIBCXX26_CONSTEXPR
328 uninitialized_copy_result<borrowed_iterator_t<_IRange>,
329 borrowed_iterator_t<_ORange>>
330 operator()(_IRange&& __inr, _ORange&& __outr) const
331 {
332 return (*this)(ranges::begin(__inr), ranges::end(__inr),
333 ranges::begin(__outr), ranges::end(__outr));
334 }
335 };
336
337 inline constexpr __uninitialized_copy_fn uninitialized_copy{};
338
339 template<typename _Iter, typename _Out>
340 using uninitialized_copy_n_result = in_out_result<_Iter, _Out>;
341
342 struct __uninitialized_copy_n_fn
343 {
344 template<input_iterator _Iter, __detail::__nothrow_forward_iterator _Out,
345 __detail::__nothrow_sentinel<_Out> _Sent>
346 requires constructible_from<iter_value_t<_Out>, iter_reference_t<_Iter>>
347 _GLIBCXX26_CONSTEXPR
348 uninitialized_copy_n_result<_Iter, _Out>
349 operator()(_Iter __ifirst, iter_difference_t<_Iter> __n,
350 _Out __ofirst, _Sent __olast) const
351 {
352 using _OutType = remove_reference_t<iter_reference_t<_Out>>;
353 if constexpr (sized_sentinel_for<_Sent, _Out>
354 && is_trivially_constructible_v<_OutType, iter_reference_t<_Iter>>
355 && is_trivially_default_constructible_v<_OutType>
356 && is_trivially_assignable_v<_OutType&,
357 iter_reference_t<_Iter>>)
358 {
359 auto __d = __olast - __ofirst;
360 return ranges::copy_n(std::move(__ifirst),
361 __detail::__mindist(__n, __d), __ofirst);
362 }
363 else
364 {
365 auto __guard = __detail::_DestroyGuard(__ofirst);
366 for (; __n > 0 && __ofirst != __olast;
367 ++__ofirst, (void)++__ifirst, (void)--__n)
368 ::new (__detail::__voidify(*__ofirst)) _OutType(*__ifirst);
369 __guard.release();
370 return {std::move(__ifirst), __ofirst};
371 }
372 }
373 };
374
375 inline constexpr __uninitialized_copy_n_fn uninitialized_copy_n{};
376
377 template<typename _Iter, typename _Out>
378 using uninitialized_move_result = in_out_result<_Iter, _Out>;
379
380 struct __uninitialized_move_fn
381 {
382 template<input_iterator _Iter, sentinel_for<_Iter> _ISent,
383 __detail::__nothrow_forward_iterator _Out,
384 __detail::__nothrow_sentinel<_Out> _OSent>
385 requires constructible_from<iter_value_t<_Out>,
386 iter_rvalue_reference_t<_Iter>>
387 _GLIBCXX26_CONSTEXPR
388 uninitialized_move_result<_Iter, _Out>
389 operator()(_Iter __ifirst, _ISent __ilast,
390 _Out __ofirst, _OSent __olast) const
391 {
392 using _OutType = remove_reference_t<iter_reference_t<_Out>>;
393 if constexpr (sized_sentinel_for<_ISent, _Iter>
394 && sized_sentinel_for<_OSent, _Out>
395 && is_trivially_constructible_v<_OutType, iter_rvalue_reference_t<_Iter>>
396 && is_trivially_default_constructible_v<_OutType>
397 && is_trivially_assignable_v<_OutType&,
398 iter_rvalue_reference_t<_Iter>>)
399 {
400 auto __d1 = __ilast - __ifirst;
401 auto __d2 = __olast - __ofirst;
402 auto [__in, __out]
403 = ranges::copy_n(std::make_move_iterator(std::move(__ifirst)),
404 __detail::__mindist(__d1, __d2), __ofirst);
405 return {std::move(__in).base(), __out};
406 }
407 else
408 {
409 auto __guard = __detail::_DestroyGuard(__ofirst);
410 for (; __ifirst != __ilast && __ofirst != __olast;
411 ++__ofirst, (void)++__ifirst)
412 ::new (__detail::__voidify(*__ofirst))
413 _OutType(ranges::iter_move(__ifirst));
414 __guard.release();
415 return {std::move(__ifirst), __ofirst};
416 }
417 }
418
419 template<input_range _IRange, __detail::__nothrow_forward_range _ORange>
420 requires constructible_from<range_value_t<_ORange>,
421 range_rvalue_reference_t<_IRange>>
422 _GLIBCXX26_CONSTEXPR
423 uninitialized_move_result<borrowed_iterator_t<_IRange>,
424 borrowed_iterator_t<_ORange>>
425 operator()(_IRange&& __inr, _ORange&& __outr) const
426 {
427 return (*this)(ranges::begin(__inr), ranges::end(__inr),
428 ranges::begin(__outr), ranges::end(__outr));
429 }
430 };
431
432 inline constexpr __uninitialized_move_fn uninitialized_move{};
433
434 template<typename _Iter, typename _Out>
435 using uninitialized_move_n_result = in_out_result<_Iter, _Out>;
436
437 struct __uninitialized_move_n_fn
438 {
439 template<input_iterator _Iter, __detail::__nothrow_forward_iterator _Out,
440 __detail::__nothrow_sentinel<_Out> _Sent>
441 requires constructible_from<iter_value_t<_Out>,
442 iter_rvalue_reference_t<_Iter>>
443 _GLIBCXX26_CONSTEXPR
444 uninitialized_move_n_result<_Iter, _Out>
445 operator()(_Iter __ifirst, iter_difference_t<_Iter> __n,
446 _Out __ofirst, _Sent __olast) const
447 {
448 using _OutType = remove_reference_t<iter_reference_t<_Out>>;
449 if constexpr (sized_sentinel_for<_Sent, _Out>
450 && is_trivially_constructible_v<_OutType, iter_rvalue_reference_t<_Iter>>
451 && is_trivially_default_constructible_v<_OutType>
452 && is_trivially_assignable_v<_OutType&,
453 iter_rvalue_reference_t<_Iter>>)
454 {
455 auto __d = __olast - __ofirst;
456 auto [__in, __out]
457 = ranges::copy_n(std::make_move_iterator(std::move(__ifirst)),
458 __detail::__mindist(__n, __d), __ofirst);
459 return {std::move(__in).base(), __out};
460 }
461 else
462 {
463 auto __guard = __detail::_DestroyGuard(__ofirst);
464 for (; __n > 0 && __ofirst != __olast;
465 ++__ofirst, (void)++__ifirst, (void)--__n)
466 ::new (__detail::__voidify(*__ofirst))
467 _OutType(ranges::iter_move(__ifirst));
468 __guard.release();
469 return {std::move(__ifirst), __ofirst};
470 }
471 }
472 };
473
474 inline constexpr __uninitialized_move_n_fn uninitialized_move_n{};
475
476 struct __uninitialized_fill_fn
477 {
478 template<__detail::__nothrow_forward_iterator _Iter,
479 __detail::__nothrow_sentinel<_Iter> _Sent, typename _Tp>
480 requires constructible_from<iter_value_t<_Iter>, const _Tp&>
481 _GLIBCXX26_CONSTEXPR
482 _Iter
483 operator()(_Iter __first, _Sent __last, const _Tp& __x) const
484 {
485 using _ValueType = remove_reference_t<iter_reference_t<_Iter>>;
486 if constexpr (is_trivially_constructible_v<_ValueType, const _Tp&>
487 && is_trivially_assignable_v<_ValueType&, const _Tp&>)
488 return ranges::fill(__first, __last, __x);
489 else
490 {
491 auto __guard = __detail::_DestroyGuard(__first);
492 for (; __first != __last; ++__first)
493 ::new (__detail::__voidify(*__first)) _ValueType(__x);
494 __guard.release();
495 return __first;
496 }
497 }
498
499 template<__detail::__nothrow_forward_range _Range, typename _Tp>
500 requires constructible_from<range_value_t<_Range>, const _Tp&>
501 _GLIBCXX26_CONSTEXPR
502 borrowed_iterator_t<_Range>
503 operator()(_Range&& __r, const _Tp& __x) const
504 {
505 return (*this)(ranges::begin(__r), ranges::end(__r), __x);
506 }
507 };
508
509 inline constexpr __uninitialized_fill_fn uninitialized_fill{};
510
511 struct __uninitialized_fill_n_fn
512 {
513 template<__detail::__nothrow_forward_iterator _Iter, typename _Tp>
514 requires constructible_from<iter_value_t<_Iter>, const _Tp&>
515 _GLIBCXX26_CONSTEXPR
516 _Iter
517 operator()(_Iter __first, iter_difference_t<_Iter> __n,
518 const _Tp& __x) const
519 {
520 using _ValueType = remove_reference_t<iter_reference_t<_Iter>>;
521 if constexpr (is_trivially_constructible_v<_ValueType, const _Tp&>
522 && is_trivially_assignable_v<_ValueType&, const _Tp&>)
523 return ranges::fill_n(__first, __n, __x);
524 else
525 {
526 auto __guard = __detail::_DestroyGuard(__first);
527 for (; __n > 0; ++__first, (void)--__n)
528 ::new (__detail::__voidify(*__first)) _ValueType(__x);
529 __guard.release();
530 return __first;
531 }
532 }
533 };
534
535 inline constexpr __uninitialized_fill_n_fn uninitialized_fill_n{};
536
537 struct __construct_at_fn
538 {
539 template<typename _Tp, typename... _Args>
540 requires requires {
541 ::new (std::declval<void*>()) _Tp(std::declval<_Args>()...);
542 }
543 constexpr _Tp*
544 operator()(_Tp* __location, _Args&&... __args) const
545 noexcept(noexcept(std::construct_at(__location,
546 std::forward<_Args>(__args)...)))
547 {
548 return std::construct_at(__location,
549 std::forward<_Args>(__args)...);
550 }
551 };
552
553 inline constexpr __construct_at_fn construct_at{};
554
555 struct __destroy_at_fn
556 {
557 template<destructible _Tp>
558 constexpr void
559 operator()(_Tp* __location) const noexcept
560 {
561 if constexpr (is_array_v<_Tp>)
562 ranges::destroy(ranges::begin(*__location), ranges::end(*__location));
563 else
564 __location->~_Tp();
565 }
566 };
567
568 inline constexpr __destroy_at_fn destroy_at{};
569
570 template<__detail::__nothrow_input_iterator _Iter,
571 __detail::__nothrow_sentinel<_Iter> _Sent>
572 requires destructible<iter_value_t<_Iter>>
573 constexpr _Iter
574 __destroy_fn::operator()(_Iter __first, _Sent __last) const noexcept
575 {
576 if constexpr (is_trivially_destructible_v<iter_value_t<_Iter>>)
577 return ranges::next(std::move(__first), __last);
578 else
579 {
580 for (; __first != __last; ++__first)
581 ranges::destroy_at(std::__addressof(*__first));
582 return __first;
583 }
584 }
585
586 template<__detail::__nothrow_input_range _Range>
587 requires destructible<range_value_t<_Range>>
588 constexpr borrowed_iterator_t<_Range>
589 __destroy_fn::operator()(_Range&& __r) const noexcept
590 {
591 return (*this)(ranges::begin(__r), ranges::end(__r));
592 }
593
594 struct __destroy_n_fn
595 {
596 template<__detail::__nothrow_input_iterator _Iter>
597 requires destructible<iter_value_t<_Iter>>
598 constexpr _Iter
599 operator()(_Iter __first, iter_difference_t<_Iter> __n) const noexcept
600 {
601 if constexpr (is_trivially_destructible_v<iter_value_t<_Iter>>)
602 return ranges::next(std::move(__first), __n);
603 else
604 {
605 for (; __n > 0; ++__first, (void)--__n)
606 ranges::destroy_at(std::__addressof(*__first));
607 return __first;
608 }
609 }
610 };
611
612 inline constexpr __destroy_n_fn destroy_n{};
613}
614_GLIBCXX_END_NAMESPACE_VERSION
615} // namespace std
616
617#endif // concepts
618#endif // C++20
619#endif // _RANGES_UNINITIALIZED_H
_ForwardIterator uninitialized_copy_n(_InputIterator __first, _Size __n, _ForwardIterator __result)
Copies the range [first,first+n) into result.
void uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp &__x)
Copies the value x into the range [first,last).
_ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __count)
Value-initializes objects in the range [first,first+count).
_ForwardIterator uninitialized_move(_InputIterator __first, _InputIterator __last, _ForwardIterator __result)
Move-construct from the range [first,last) into result.
_ForwardIterator uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp &__x)
Copies the value x into the range [first,first+n).
_ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Size __count)
Default-initializes objects in the range [first,first+count).
void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last)
Default-initializes objects in the range [first,last).
_ForwardIterator uninitialized_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result)
Copies the range [first,last) into result.
void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last)
Value-initializes objects in the range [first,last).
pair< _InputIterator, _ForwardIterator > uninitialized_move_n(_InputIterator __first, _Size __count, _ForwardIterator __result)
Move-construct from the range [first,first+count) into result.
auto declval() noexcept -> decltype(__declval< _Tp >(0))
Definition type_traits:2609
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
Definition move.h:138
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
Definition move.h:52
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
Definition move.h:72
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
ISO C++ entities toplevel namespace is std.