-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathmemory
More file actions
4606 lines (3826 loc) · 178 KB
/
memory
File metadata and controls
4606 lines (3826 loc) · 178 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// memory standard header
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef _MEMORY_
#define _MEMORY_
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#include <exception>
#include <iosfwd>
#include <type_traits>
#include <typeinfo>
#include <xmemory>
#if _HAS_CXX20
#include <atomic>
#endif // _HAS_CXX20
#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
_STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new
// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#undef msvc
_STD_BEGIN
#if _HAS_CXX17
#define _REQUIRE_PARALLEL_LVALUE_ITERATOR(_Iter) \
static_assert(_Is_ranges_fwd_iter_v<_Iter> && is_lvalue_reference_v<_Iter_ref_t<_Iter>>, \
"Parallel specialized <memory> algorithms require the iterator type to be forward iterator and dereference " \
"to lvalues.")
_EXPORT_STD template <class _ExPo, class _FwdIt, class _NoThrowFwdIt, _Enable_if_execution_policy_t<_ExPo> = 0>
_NoThrowFwdIt uninitialized_copy(_ExPo&&, const _FwdIt _First, const _FwdIt _Last, _NoThrowFwdIt _Dest) noexcept
/* terminates */ {
// copy [_First, _Last) to raw [_Dest, ...)
// not parallelized at present
_REQUIRE_PARALLEL_ITERATOR(_FwdIt);
_REQUIRE_PARALLEL_LVALUE_ITERATOR(_NoThrowFwdIt);
return _STD uninitialized_copy(_First, _Last, _Dest);
}
#endif // _HAS_CXX17
#if _HAS_CXX20
namespace ranges {
_EXPORT_STD template <class _In, class _Out>
using uninitialized_copy_result = in_out_result<_In, _Out>;
class _Uninitialized_copy_fn {
public:
template <input_iterator _It, sentinel_for<_It> _Se, _No_throw_forward_iterator _Out,
_No_throw_sentinel_for<_Out> _OSe>
requires constructible_from<iter_value_t<_Out>, iter_reference_t<_It>>
static uninitialized_copy_result<_It, _Out> operator()(_It _First1, _Se _Last1, _Out _First2, _OSe _Last2) {
_STD _Adl_verify_range(_First1, _Last1);
_STD _Adl_verify_range(_First2, _Last2);
auto _UResult = _Uninitialized_copy_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First1)),
_RANGES _Unwrap_sent<_It>(_STD move(_Last1)), _RANGES _Unwrap_iter<_OSe>(_STD move(_First2)),
_RANGES _Unwrap_sent<_Out>(_STD move(_Last2)));
_STD _Seek_wrapped(_First1, _STD move(_UResult.in));
_STD _Seek_wrapped(_First2, _STD move(_UResult.out));
return {_STD move(_First1), _STD move(_First2)};
}
template <input_range _Rng1, _No_throw_forward_range _Rng2>
requires constructible_from<range_value_t<_Rng2>, range_reference_t<_Rng1>>
static uninitialized_copy_result<borrowed_iterator_t<_Rng1>, borrowed_iterator_t<_Rng2>> operator()(
_Rng1&& _Range1, _Rng2&& _Range2) {
auto _First1 = _RANGES begin(_Range1);
auto _UResult = _Uninitialized_copy_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)),
_Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2));
_STD _Seek_wrapped(_First1, _STD move(_UResult.in));
return {_STD move(_First1), _RANGES _Rewrap_iterator(_Range2, _STD move(_UResult.out))};
}
private:
template <class _It, class _Se, class _Out, class _OSe>
_NODISCARD static uninitialized_copy_result<_It, _Out> _Uninitialized_copy_unchecked(
_It _IFirst, _Se _ILast, _Out _OFirst, _OSe _OLast) {
_STL_INTERNAL_STATIC_ASSERT(input_iterator<_It>);
_STL_INTERNAL_STATIC_ASSERT(sentinel_for<_Se, _It>);
_STL_INTERNAL_STATIC_ASSERT(_No_throw_forward_iterator<_Out>);
_STL_INTERNAL_STATIC_ASSERT(_No_throw_sentinel_for<_OSe, _Out>);
_STL_INTERNAL_STATIC_ASSERT(constructible_from<iter_value_t<_Out>, iter_reference_t<_It>>);
constexpr bool _Is_sized1 = sized_sentinel_for<_Se, _It>;
constexpr bool _Is_sized2 = sized_sentinel_for<_OSe, _Out>;
constexpr bool _Can_memcpy = _Iter_copy_cat<_It, _Out>::_Bitcopy_constructible
&& _Sized_or_unreachable_sentinel_for<_Se, _It>
&& _Sized_or_unreachable_sentinel_for<_OSe, _Out>;
if constexpr (_Can_memcpy && (_Is_sized1 || _Is_sized2)) {
if constexpr (_Is_sized1 && _Is_sized2) {
return _RANGES _Copy_memcpy_common(_IFirst, _RANGES next(_IFirst, _STD move(_ILast)), _OFirst,
_RANGES next(_OFirst, _STD move(_OLast)));
} else if constexpr (_Is_sized1) {
const auto _Dist = _ILast - _IFirst;
_STD _Contiguous_iter_verify(_OFirst, static_cast<iter_difference_t<_Out>>(_Dist));
return _RANGES _Copy_memcpy_distance(_IFirst, _OFirst, _IFirst, _IFirst + _Dist);
} else {
_STL_INTERNAL_STATIC_ASSERT(_Is_sized2);
const auto _Dist = _OLast - _OFirst;
_STD _Contiguous_iter_verify(_IFirst, static_cast<iter_difference_t<_It>>(_Dist));
return _RANGES _Copy_memcpy_distance(_IFirst, _OFirst, _OFirst, _OFirst + _Dist);
}
} else {
if constexpr (_Can_memcpy) {
// We were eligible for the memcpy optimization above, except for both sentinels being unreachable.
// The following classic code is doomed, because no exceptions will end the infinite loop.
// Following our usual pattern, let's emit a debug assertion, then run the loop anyways.
_STL_ASSERT(false, "Tried to std::uninitialized_copy() two ranges with unreachable sentinels");
}
_Uninitialized_backout _Backout{_STD move(_OFirst)};
for (; _IFirst != _ILast && _Backout._Last != _OLast; ++_IFirst) {
_Backout._Emplace_back(*_IFirst);
}
return {_STD move(_IFirst), _Backout._Release()};
}
}
};
_EXPORT_STD inline constexpr _Uninitialized_copy_fn uninitialized_copy;
} // namespace ranges
#endif // _HAS_CXX20
_EXPORT_STD template <class _InIt, class _Diff, class _NoThrowFwdIt>
_NoThrowFwdIt uninitialized_copy_n(const _InIt _First, const _Diff _Count_raw, _NoThrowFwdIt _Dest) {
// copy [_First, _First + _Count) to [_Dest, ...)
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (_Count <= 0) {
return _Dest;
}
auto _UFirst = _STD _Get_unwrapped_n(_First, _Count);
auto _UDest = _STD _Get_unwrapped_n(_Dest, _Count);
if constexpr (_Iter_copy_cat<decltype(_UFirst), decltype(_UDest)>::_Bitcopy_constructible) {
_UDest = _STD _Copy_memcpy_n(_UFirst, static_cast<size_t>(_Count), _UDest);
} else {
_Uninitialized_backout<decltype(_UDest)> _Backout{_UDest};
for (; _Count > 0; --_Count, (void) ++_UFirst) {
_Backout._Emplace_back_deref(_UFirst);
}
_UDest = _Backout._Release();
}
_STD _Seek_wrapped(_Dest, _UDest);
return _Dest;
}
#if _HAS_CXX17
_EXPORT_STD template <class _ExPo, class _FwdIt, class _Diff, class _NoThrowFwdIt,
_Enable_if_execution_policy_t<_ExPo> = 0>
_NoThrowFwdIt uninitialized_copy_n(_ExPo&&, const _FwdIt _First, const _Diff _Count_raw, _NoThrowFwdIt _Dest) noexcept
/* terminates */ {
// copy [_First, _First + _Count) to raw [_Dest, ...)
// not parallelized at present
_REQUIRE_PARALLEL_ITERATOR(_FwdIt);
_REQUIRE_PARALLEL_LVALUE_ITERATOR(_NoThrowFwdIt);
_Algorithm_int_t<_Diff> _Count = _Count_raw;
return _STD uninitialized_copy_n(_First, _Count, _Dest);
}
#endif // _HAS_CXX17
#if _HAS_CXX20
namespace ranges {
_EXPORT_STD template <class _In, class _Out>
using uninitialized_copy_n_result = in_out_result<_In, _Out>;
struct _Uninitialized_copy_n_fn {
template <input_iterator _It, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe>
requires constructible_from<iter_value_t<_Out>, iter_reference_t<_It>>
static uninitialized_copy_n_result<_It, _Out> operator()(
_It _First1, iter_difference_t<_It> _Count, _Out _First2, _OSe _Last2) {
if (_Count <= 0) {
return {_STD move(_First1), _STD move(_First2)};
}
_STD _Adl_verify_range(_First2, _Last2);
auto _IFirst = _STD _Get_unwrapped_n(_STD move(_First1), _Count);
auto _OFirst = _RANGES _Unwrap_iter<_OSe>(_STD move(_First2));
auto _OLast = _RANGES _Unwrap_sent<_Out>(_STD move(_Last2));
if constexpr (_Iter_copy_cat<_It, _Out>::_Bitcopy_constructible
&& _Sized_or_unreachable_sentinel_for<_OSe, _Out>) {
if constexpr (sized_sentinel_for<_OSe, _Out>) {
auto _UResult = _RANGES _Copy_memcpy_common(
_IFirst, _IFirst + _Count, _OFirst, _RANGES next(_OFirst, _STD move(_OLast)));
_IFirst = _STD move(_UResult.in);
_OFirst = _STD move(_UResult.out);
} else {
_STD _Contiguous_iter_verify(_IFirst, _Count);
_STD _Contiguous_iter_verify(_OFirst, static_cast<iter_difference_t<_Out>>(_Count));
auto _UResult = _RANGES _Copy_memcpy_count(_IFirst, _OFirst, static_cast<size_t>(_Count));
_IFirst = _STD move(_UResult.in);
_OFirst = _STD move(_UResult.out);
}
} else {
_Uninitialized_backout _Backout{_STD move(_OFirst)};
for (; _Count > 0 && _Backout._Last != _OLast; --_Count, (void) ++_IFirst) {
_Backout._Emplace_back(*_IFirst);
}
_OFirst = _Backout._Release();
}
_STD _Seek_wrapped(_First1, _STD move(_IFirst));
_STD _Seek_wrapped(_First2, _STD move(_OFirst));
return {_STD move(_First1), _STD move(_First2)};
}
};
_EXPORT_STD inline constexpr _Uninitialized_copy_n_fn uninitialized_copy_n;
} // namespace ranges
#endif // _HAS_CXX20
#if _HAS_CXX17
_EXPORT_STD template <class _InIt, class _NoThrowFwdIt>
_NoThrowFwdIt uninitialized_move(const _InIt _First, const _InIt _Last, _NoThrowFwdIt _Dest) {
// move [_First, _Last) to raw [_Dest, ...)
_STD _Adl_verify_range(_First, _Last);
const auto _UFirst = _STD _Get_unwrapped(_First);
const auto _ULast = _STD _Get_unwrapped(_Last);
const auto _UDest = _STD _Get_unwrapped_n(_Dest, _STD _Idl_distance<_InIt>(_UFirst, _ULast));
_STD _Seek_wrapped(_Dest, _STD _Uninitialized_move_unchecked(_UFirst, _ULast, _UDest));
return _Dest;
}
_EXPORT_STD template <class _ExPo, class _FwdIt, class _NoThrowFwdIt, _Enable_if_execution_policy_t<_ExPo> = 0>
_NoThrowFwdIt uninitialized_move(_ExPo&&, const _FwdIt _First, const _FwdIt _Last, _NoThrowFwdIt _Dest) noexcept
/* terminates */ {
// move [_First, _Last) to raw [_Dest, ...)
// not parallelized at present
_REQUIRE_PARALLEL_ITERATOR(_FwdIt);
_REQUIRE_PARALLEL_LVALUE_ITERATOR(_NoThrowFwdIt);
return _STD uninitialized_move(_First, _Last, _Dest);
}
#if _HAS_CXX20
namespace ranges {
struct _Uninitialized_move_fn {
template <input_iterator _It, sentinel_for<_It> _Se, _No_throw_forward_iterator _Out,
_No_throw_sentinel_for<_Out> _OSe>
requires constructible_from<iter_value_t<_Out>, iter_rvalue_reference_t<_It>>
static uninitialized_move_result<_It, _Out> operator()(_It _First1, _Se _Last1, _Out _First2, _OSe _Last2) {
_STD _Adl_verify_range(_First1, _Last1);
_STD _Adl_verify_range(_First2, _Last2);
auto _UResult = _RANGES _Uninitialized_move_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First1)),
_RANGES _Unwrap_sent<_It>(_STD move(_Last1)), _RANGES _Unwrap_iter<_OSe>(_STD move(_First2)),
_RANGES _Unwrap_sent<_Out>(_STD move(_Last2)));
_STD _Seek_wrapped(_First1, _STD move(_UResult.in));
_STD _Seek_wrapped(_First2, _STD move(_UResult.out));
return {_STD move(_First1), _STD move(_First2)};
}
template <input_range _Rng1, _No_throw_forward_range _Rng2>
requires constructible_from<range_value_t<_Rng2>, range_rvalue_reference_t<_Rng1>>
static uninitialized_move_result<borrowed_iterator_t<_Rng1>, borrowed_iterator_t<_Rng2>> operator()(
_Rng1&& _Range1, _Rng2&& _Range2) {
auto _First1 = _RANGES begin(_Range1);
auto _UResult = _RANGES _Uninitialized_move_unchecked(_RANGES _Unwrap_range_iter<_Rng1>(_STD move(_First1)),
_Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2));
_STD _Seek_wrapped(_First1, _STD move(_UResult.in));
return {_STD move(_First1), _RANGES _Rewrap_iterator(_Range2, _STD move(_UResult.out))};
}
};
_EXPORT_STD inline constexpr _Uninitialized_move_fn uninitialized_move;
} // namespace ranges
#endif // _HAS_CXX20
_EXPORT_STD template <class _InIt, class _Diff, class _NoThrowFwdIt>
pair<_InIt, _NoThrowFwdIt> uninitialized_move_n(_InIt _First, const _Diff _Count_raw, _NoThrowFwdIt _Dest) {
// move [_First, _First + _Count) to [_Dest, ...)
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (_Count <= 0) {
return {_First, _Dest};
}
auto _UFirst = _STD _Get_unwrapped_n(_First, _Count);
auto _UDest = _STD _Get_unwrapped_n(_Dest, _Count);
if constexpr (_Iter_move_cat<decltype(_UFirst), decltype(_UDest)>::_Bitcopy_constructible) {
_UDest = _STD _Copy_memcpy_n(_UFirst, static_cast<size_t>(_Count), _UDest);
_UFirst += _Count;
} else {
_Uninitialized_backout<decltype(_UDest)> _Backout{_UDest};
for (; _Count > 0; --_Count, (void) ++_UFirst) {
_Backout._Emplace_back_deref_move(_UFirst);
}
_UDest = _Backout._Release();
}
_STD _Seek_wrapped(_Dest, _UDest);
_STD _Seek_wrapped(_First, _UFirst);
return {_First, _Dest};
}
_EXPORT_STD template <class _ExPo, class _FwdIt, class _Diff, class _NoThrowFwdIt,
_Enable_if_execution_policy_t<_ExPo> = 0>
pair<_FwdIt, _NoThrowFwdIt> uninitialized_move_n(
_ExPo&&, const _FwdIt _First, const _Diff _Count_raw, _NoThrowFwdIt _Dest) noexcept /* terminates */ {
// move [_First, _First + _Count) to raw [_Dest, ...)
// not parallelized at present
_REQUIRE_PARALLEL_ITERATOR(_FwdIt);
_REQUIRE_PARALLEL_LVALUE_ITERATOR(_NoThrowFwdIt);
_Algorithm_int_t<_Diff> _Count = _Count_raw;
return _STD uninitialized_move_n(_First, _Count, _Dest);
}
_EXPORT_STD template <class _ExPo, class _NoThrowFwdIt, class _Tval, _Enable_if_execution_policy_t<_ExPo> = 0>
void uninitialized_fill(_ExPo&&, const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last, const _Tval& _Val) noexcept
/* terminates */ {
// copy _Val throughout raw [_First, _Last)
// not parallelized at present
_REQUIRE_PARALLEL_LVALUE_ITERATOR(_NoThrowFwdIt);
_STD uninitialized_fill(_First, _Last, _Val);
}
#endif // _HAS_CXX17
#if _HAS_CXX20
namespace ranges {
_EXPORT_STD template <class _In, class _Out>
using uninitialized_move_n_result = in_out_result<_In, _Out>;
struct _Uninitialized_move_n_fn {
template <input_iterator _It, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe>
requires constructible_from<iter_value_t<_Out>, iter_rvalue_reference_t<_It>>
static uninitialized_move_n_result<_It, _Out> operator()(
_It _First1, iter_difference_t<_It> _Count, _Out _First2, _OSe _Last2) {
if (_Count <= 0) {
return {_STD move(_First1), _STD move(_First2)};
}
_STD _Adl_verify_range(_First2, _Last2);
auto _IFirst = _STD _Get_unwrapped_n(_STD move(_First1), _Count);
auto _OFirst = _RANGES _Unwrap_iter<_OSe>(_STD move(_First2));
const auto _OLast = _RANGES _Unwrap_sent<_Out>(_STD move(_Last2));
if constexpr (_Iter_move_cat<_It, _Out>::_Bitcopy_constructible
&& _Sized_or_unreachable_sentinel_for<_OSe, _Out>) {
if constexpr (sized_sentinel_for<_OSe, _Out>) {
auto _UResult = _RANGES _Copy_memcpy_common(
_IFirst, _IFirst + _Count, _OFirst, _RANGES next(_OFirst, _STD move(_OLast)));
_IFirst = _STD move(_UResult.in);
_OFirst = _STD move(_UResult.out);
} else {
_STD _Contiguous_iter_verify(_IFirst, _Count);
_STD _Contiguous_iter_verify(_OFirst, static_cast<iter_difference_t<_Out>>(_Count));
auto _UResult = _RANGES _Copy_memcpy_count(_IFirst, _OFirst, static_cast<size_t>(_Count));
_IFirst = _STD move(_UResult.in);
_OFirst = _STD move(_UResult.out);
}
} else {
_Uninitialized_backout _Backout{_STD move(_OFirst)};
for (; _Count > 0 && _Backout._Last != _OLast; --_Count, (void) ++_IFirst) {
_Backout._Emplace_back(_RANGES iter_move(_IFirst));
}
_OFirst = _Backout._Release();
}
_STD _Seek_wrapped(_First1, _STD move(_IFirst));
_STD _Seek_wrapped(_First2, _STD move(_OFirst));
return {_STD move(_First1), _STD move(_First2)};
}
};
_EXPORT_STD inline constexpr _Uninitialized_move_n_fn uninitialized_move_n;
class _Uninitialized_fill_fn {
public:
template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se, class _Ty>
requires constructible_from<iter_value_t<_It>, const _Ty&>
static _It operator()(_It _First, _Se _Last, const _Ty& _Val) {
_STD _Adl_verify_range(_First, _Last);
auto _UResult = _Uninitialized_fill_unchecked(
_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)), _Val);
_STD _Seek_wrapped(_First, _STD move(_UResult));
return _First;
}
template <_No_throw_forward_range _Rng, class _Ty>
requires constructible_from<range_value_t<_Rng>, const _Ty&>
static borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, const _Ty& _Val) {
return _RANGES _Rewrap_iterator(
_Range, _Uninitialized_fill_unchecked(_Ubegin(_Range), _Uend(_Range), _Val));
}
private:
template <class _It, class _Se, class _Ty>
_NODISCARD static _It _Uninitialized_fill_unchecked(_It _OFirst, _Se _OLast, const _Ty& _Val) {
_STL_INTERNAL_STATIC_ASSERT(_No_throw_forward_iterator<_It>);
_STL_INTERNAL_STATIC_ASSERT(_No_throw_sentinel_for<_Se, _It>);
_STL_INTERNAL_STATIC_ASSERT(constructible_from<iter_value_t<_It>, const _Ty&>);
if constexpr (_Fill_memset_is_safe<_It, _Ty>) {
const auto _OFinal = _RANGES next(_OFirst, _STD move(_OLast));
_STD _Fill_memset(_OFirst, _Val, static_cast<size_t>(_OFinal - _OFirst));
return _OFinal;
} else {
if constexpr (_Fill_zero_memset_is_safe<_It, _Ty>) {
if (_STD _Is_all_bits_zero(_Val)) {
const auto _OFinal = _RANGES next(_OFirst, _STD move(_OLast));
_STD _Fill_zero_memset(_OFirst, static_cast<size_t>(_OFinal - _OFirst));
return _OFinal;
}
}
_Uninitialized_backout _Backout{_STD move(_OFirst)};
while (_Backout._Last != _OLast) {
_Backout._Emplace_back(_Val);
}
return _Backout._Release();
}
}
};
_EXPORT_STD inline constexpr _Uninitialized_fill_fn uninitialized_fill;
} // namespace ranges
#endif // _HAS_CXX20
_EXPORT_STD template <class _NoThrowFwdIt, class _Diff, class _Tval>
_NoThrowFwdIt uninitialized_fill_n(_NoThrowFwdIt _First, const _Diff _Count_raw, const _Tval& _Val) {
// copy _Count copies of _Val to raw _First
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (_Count <= 0) {
return _First;
}
auto _UFirst = _STD _Get_unwrapped_n(_First, _Count);
if constexpr (_Fill_memset_is_safe<decltype(_UFirst), _Tval>) {
_STD _Fill_memset(_UFirst, _Val, static_cast<size_t>(_Count));
_UFirst += _Count;
} else {
if constexpr (_Fill_zero_memset_is_safe<decltype(_UFirst), _Tval>) {
if (_STD _Is_all_bits_zero(_Val)) {
_STD _Fill_zero_memset(_UFirst, static_cast<size_t>(_Count));
_STD _Seek_wrapped(_First, _UFirst + _Count);
return _First;
}
}
_Uninitialized_backout<decltype(_UFirst)> _Backout{_UFirst};
for (; _Count > 0; --_Count) {
_Backout._Emplace_back(_Val);
}
_UFirst = _Backout._Release();
}
_STD _Seek_wrapped(_First, _UFirst);
return _First;
}
#if _HAS_CXX17
_EXPORT_STD template <class _ExPo, class _NoThrowFwdIt, class _Diff, class _Tval,
_Enable_if_execution_policy_t<_ExPo> = 0>
_NoThrowFwdIt uninitialized_fill_n(
_ExPo&&, const _NoThrowFwdIt _First, const _Diff _Count_raw, const _Tval& _Val) noexcept
/* terminates */ {
// copy _Count copies of _Val to raw _First
// not parallelized at present
_REQUIRE_PARALLEL_LVALUE_ITERATOR(_NoThrowFwdIt);
_Algorithm_int_t<_Diff> _Count = _Count_raw;
return _STD uninitialized_fill_n(_First, _Count, _Val);
}
#endif // _HAS_CXX17
#if _HAS_CXX20
namespace ranges {
struct _Uninitialized_fill_n_fn {
template <_No_throw_forward_iterator _It, class _Ty>
requires constructible_from<iter_value_t<_It>, const _Ty&>
static _It operator()(_It _First, iter_difference_t<_It> _Count, const _Ty& _Val) {
if (_Count <= 0) {
return _First;
}
auto _UFirst = _STD _Get_unwrapped_n(_STD move(_First), _Count);
if constexpr (_Fill_memset_is_safe<decltype(_UFirst), _Ty>) {
_STD _Fill_memset(_UFirst, _Val, static_cast<size_t>(_Count));
_STD _Seek_wrapped(_First, _UFirst + _Count);
} else {
if constexpr (_Fill_zero_memset_is_safe<decltype(_UFirst), _Ty>) {
if (_STD _Is_all_bits_zero(_Val)) {
_STD _Fill_zero_memset(_UFirst, static_cast<size_t>(_Count));
_STD _Seek_wrapped(_First, _UFirst + _Count);
return _First;
}
}
_Uninitialized_backout _Backout{_STD move(_UFirst)};
for (; _Count > 0; --_Count) {
_Backout._Emplace_back(_Val);
}
_STD _Seek_wrapped(_First, _Backout._Release());
}
return _First;
}
};
_EXPORT_STD inline constexpr _Uninitialized_fill_n_fn uninitialized_fill_n;
struct _Construct_at_fn {
template <class _Ty, class... _Types>
requires (!is_unbounded_array_v<_Ty>) && requires(_Ty* _Ptr, _Types&&... _Args) {
::new (static_cast<void*>(_Ptr)) _Ty(static_cast<_Types &&>(_Args)...); // per LWG-3888
}
static constexpr _Ty* operator()(_Ty* _Location, _Types&&... _Args) noexcept(
noexcept(::new (static_cast<void*>(_Location)) _Ty(_STD forward<_Types>(_Args)...))) /* strengthened */ {
#ifdef __EDG__
return _STD construct_at(_Location, _STD forward<_Types>(_Args)...);
#else // ^^^ EDG / Other vvv
if constexpr (is_array_v<_Ty>) {
static_assert(sizeof...(_Types) == 0, "The array is only allowed to be value-initialized by "
"std::ranges::construct_at. (N5032 [specialized.construct]/2)");
#if defined(__clang__) // TRANSITION, LLVM-117294
::new (static_cast<void*>(_Location)) _Ty();
return __builtin_launder(_Location); // per old resolution of LWG-3436
#else // ^^^ workaround / no workaround vvv
_MSVC_CONSTEXPR return ::new (static_cast<void*>(_Location)) _Ty[1]();
#endif // ^^^ no workaround ^^^
} else {
_MSVC_CONSTEXPR return ::new (static_cast<void*>(_Location)) _Ty(_STD forward<_Types>(_Args)...);
}
#endif // ^^^ Other ^^^
}
};
_EXPORT_STD inline constexpr _Construct_at_fn construct_at;
template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se>
requires destructible<iter_value_t<_It>>
_NODISCARD constexpr _It _Destroy_unchecked(_It _First, _Se _Last) noexcept;
struct _Destroy_at_fn {
template <destructible _Ty>
static constexpr void operator()(_Ty* const _Location) noexcept {
if constexpr (is_array_v<_Ty>) {
(void) _RANGES _Destroy_unchecked(_RANGES begin(*_Location), _RANGES end(*_Location));
} else {
_Location->~_Ty();
}
}
};
_EXPORT_STD inline constexpr _Destroy_at_fn destroy_at;
} // namespace ranges
#endif // _HAS_CXX20
#if _HAS_CXX17
_EXPORT_STD template <class _NoThrowFwdIt>
_CONSTEXPR20 void destroy(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) {
// destroy all elements in [_First, _Last)
_STD _Adl_verify_range(_First, _Last);
_STD _Destroy_range(_STD _Get_unwrapped(_First), _STD _Get_unwrapped(_Last));
}
_EXPORT_STD template <class _ExPo, class _NoThrowFwdIt, _Enable_if_execution_policy_t<_ExPo> = 0>
void destroy(_ExPo&& _Exec, _NoThrowFwdIt _First, _NoThrowFwdIt _Last) noexcept; // terminates
#if _HAS_CXX20
namespace ranges {
template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se>
requires destructible<iter_value_t<_It>>
_NODISCARD constexpr _It _Destroy_unchecked(_It _First, _Se _Last) noexcept {
if (_STD is_constant_evaluated()) {
for (; _First != _Last; ++_First) {
_RANGES destroy_at(_STD addressof(*_First));
}
} else {
if constexpr (is_trivially_destructible_v<iter_value_t<_It>>) {
_RANGES advance(_First, _STD move(_Last));
} else {
for (; _First != _Last; ++_First) {
_RANGES destroy_at(_STD addressof(*_First));
}
}
}
return _First;
}
struct _Destroy_fn {
template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se>
requires destructible<iter_value_t<_It>>
static constexpr _It operator()(_It _First, _Se _Last) noexcept {
_STD _Adl_verify_range(_First, _Last);
_STD _Seek_wrapped(_First, _RANGES _Destroy_unchecked(_RANGES _Unwrap_iter<_Se>(_STD move(_First)),
_RANGES _Unwrap_sent<_It>(_STD move(_Last))));
return _First;
}
template <_No_throw_input_range _Rng>
requires destructible<range_value_t<_Rng>>
static constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) noexcept {
auto _First = _RANGES begin(_Range);
_STD _Seek_wrapped(
_First, _RANGES _Destroy_unchecked(_RANGES _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range)));
return _First;
}
};
_EXPORT_STD inline constexpr _Destroy_fn destroy;
} // namespace ranges
#endif // _HAS_CXX20
_EXPORT_STD template <class _NoThrowFwdIt, class _Diff>
_CONSTEXPR20 _NoThrowFwdIt destroy_n(_NoThrowFwdIt _First, const _Diff _Count_raw) {
// destroy all elements in [_First, _First + _Count)
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (_Count <= 0) {
return _First;
}
auto _UFirst = _STD _Get_unwrapped_n(_First, _Count);
#if _HAS_CXX20
if (_STD is_constant_evaluated()) {
for (; _Count > 0; --_Count, (void) ++_UFirst) {
_STD _Destroy_in_place(*_UFirst);
}
} else
#endif // _HAS_CXX20
{
if constexpr (is_trivially_destructible_v<_Iter_value_t<_NoThrowFwdIt>>) {
_STD advance(_UFirst, _Count);
} else {
for (; _Count > 0; --_Count, (void) ++_UFirst) {
_STD _Destroy_in_place(*_UFirst);
}
}
}
_STD _Seek_wrapped(_First, _UFirst);
return _First;
}
_EXPORT_STD template <class _ExPo, class _NoThrowFwdIt, class _Diff, _Enable_if_execution_policy_t<_ExPo> = 0>
_NoThrowFwdIt destroy_n(_ExPo&& _Exec, _NoThrowFwdIt _First, _Diff _Count_raw) noexcept; // terminates
#if _HAS_CXX20
namespace ranges {
struct _Destroy_n_fn {
template <_No_throw_input_iterator _It>
requires destructible<iter_value_t<_It>>
static constexpr _It operator()(_It _First, iter_difference_t<_It> _Count) noexcept {
if (_Count <= 0) {
return _First;
}
auto _UFirst = _STD _Get_unwrapped_n(_STD move(_First), _Count);
if (_STD is_constant_evaluated()) {
do {
_RANGES destroy_at(_STD addressof(*_UFirst));
++_UFirst;
--_Count;
} while (_Count > 0);
} else {
if constexpr (is_trivially_destructible_v<iter_value_t<_It>>) {
_RANGES advance(_UFirst, _Count);
} else {
do {
_RANGES destroy_at(_STD addressof(*_UFirst));
++_UFirst;
--_Count;
} while (_Count > 0);
}
}
_STD _Seek_wrapped(_First, _STD move(_UFirst));
return _First;
}
};
_EXPORT_STD inline constexpr _Destroy_n_fn destroy_n;
} // namespace ranges
#endif // _HAS_CXX20
_EXPORT_STD template <class _NoThrowFwdIt>
void uninitialized_default_construct(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) {
// default-initialize all elements in [_First, _Last)
using _Ty = remove_reference_t<_Iter_ref_t<_NoThrowFwdIt>>;
_STD _Adl_verify_range(_First, _Last);
if constexpr (!is_trivially_default_constructible_v<_Ty>) {
_Uninitialized_backout _Backout{_STD _Get_unwrapped(_First)};
for (const auto _ULast = _STD _Get_unwrapped(_Last); _Backout._Last != _ULast; ++_Backout._Last) {
_STD _Default_construct_in_place(*_Backout._Last);
}
_Backout._Release();
}
}
_EXPORT_STD template <class _ExPo, class _NoThrowFwdIt, _Enable_if_execution_policy_t<_ExPo> = 0>
void uninitialized_default_construct(_ExPo&& _Exec, _NoThrowFwdIt _First, _NoThrowFwdIt _Last) noexcept; // terminates
#if _HAS_CXX20
namespace ranges {
class _Uninitialized_default_construct_fn {
public:
template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se>
requires default_initializable<iter_value_t<_It>>
static _It operator()(_It _First, _Se _Last) {
_STD _Adl_verify_range(_First, _Last);
auto _UResult = _Uninitialized_default_construct_unchecked(
_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)));
_STD _Seek_wrapped(_First, _STD move(_UResult));
return _First;
}
template <_No_throw_forward_range _Rng>
requires default_initializable<range_value_t<_Rng>>
static borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) {
auto _UResult = _Uninitialized_default_construct_unchecked(_Ubegin(_Range), _Uend(_Range));
return _RANGES _Rewrap_iterator(_Range, _STD move(_UResult));
}
private:
template <class _It, class _Se>
_NODISCARD static _It _Uninitialized_default_construct_unchecked(_It _OFirst, const _Se _OLast) {
_STL_INTERNAL_STATIC_ASSERT(_No_throw_forward_iterator<_It>);
_STL_INTERNAL_STATIC_ASSERT(_No_throw_sentinel_for<_Se, _It>);
_STL_INTERNAL_STATIC_ASSERT(default_initializable<iter_value_t<_It>>);
using _Ty = remove_reference_t<iter_reference_t<_It>>;
if constexpr (is_trivially_default_constructible_v<_Ty>) {
_RANGES advance(_OFirst, _OLast);
return _OFirst;
} else {
_Uninitialized_backout _Backout{_STD move(_OFirst)};
for (; _Backout._Last != _OLast; ++_Backout._Last) {
_STD _Default_construct_in_place(*_Backout._Last);
}
return _Backout._Release();
}
}
};
_EXPORT_STD inline constexpr _Uninitialized_default_construct_fn uninitialized_default_construct;
} // namespace ranges
#endif // _HAS_CXX20
_EXPORT_STD template <class _NoThrowFwdIt, class _Diff>
_NoThrowFwdIt uninitialized_default_construct_n(_NoThrowFwdIt _First, const _Diff _Count_raw) {
// default-initialize all elements in [_First, _First + _Count)
using _Ty = _Iter_value_t<_NoThrowFwdIt>;
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (_Count <= 0) {
return _First;
}
if constexpr (is_trivially_default_constructible_v<_Ty>) {
_STD advance(_First, _Count);
} else {
_Uninitialized_backout _Backout{_STD _Get_unwrapped_n(_First, _Count)};
for (; _Count > 0; ++_Backout._Last, (void) --_Count) {
_STD _Default_construct_in_place(*_Backout._Last);
}
_STD _Seek_wrapped(_First, _Backout._Release());
}
return _First;
}
_EXPORT_STD template <class _ExPo, class _NoThrowFwdIt, class _Diff, _Enable_if_execution_policy_t<_ExPo> = 0>
_NoThrowFwdIt uninitialized_default_construct_n(
_ExPo&& _Exec, _NoThrowFwdIt _First, _Diff _Count_raw) noexcept; // terminates
#if _HAS_CXX20
namespace ranges {
struct _Uninitialized_default_construct_n_fn {
template <_No_throw_forward_iterator _It>
requires default_initializable<iter_value_t<_It>>
static _It operator()(_It _First, iter_difference_t<_It> _Count) {
if (_Count <= 0) {
return _First;
}
using _Ty = remove_reference_t<iter_reference_t<_It>>;
if constexpr (is_trivially_default_constructible_v<_Ty>) {
_RANGES advance(_First, _Count);
} else {
_Uninitialized_backout _Backout{_STD _Get_unwrapped_n(_STD move(_First), _Count)};
for (; _Count > 0; --_Count, (void) ++_Backout._Last) {
_STD _Default_construct_in_place(*_Backout._Last);
}
_STD _Seek_wrapped(_First, _Backout._Release());
}
return _First;
}
};
_EXPORT_STD inline constexpr _Uninitialized_default_construct_n_fn uninitialized_default_construct_n;
} // namespace ranges
#endif // _HAS_CXX20
_EXPORT_STD template <class _NoThrowFwdIt>
void uninitialized_value_construct(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) {
// value-initialize all elements in [_First, _Last)
_STD _Adl_verify_range(_First, _Last);
const auto _UFirst = _STD _Get_unwrapped(_First);
const auto _ULast = _STD _Get_unwrapped(_Last);
if constexpr (_Use_memset_value_construct_v<_Unwrapped_t<const _NoThrowFwdIt&>>) {
_STD _Zero_range(_UFirst, _ULast);
} else {
_Uninitialized_backout _Backout{_UFirst};
while (_Backout._Last != _ULast) {
_Backout._Emplace_back();
}
_Backout._Release();
}
}
_EXPORT_STD template <class _ExPo, class _NoThrowFwdIt, _Enable_if_execution_policy_t<_ExPo> = 0>
void uninitialized_value_construct(_ExPo&& _Exec, _NoThrowFwdIt _First, _NoThrowFwdIt _Last) noexcept; // terminates
#if _HAS_CXX20
namespace ranges {
class _Uninitialized_value_construct_fn {
public:
template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se>
requires default_initializable<iter_value_t<_It>>
static _It operator()(_It _First, _Se _Last) {
_STD _Adl_verify_range(_First, _Last);
auto _UResult = _Uninitialized_value_construct_unchecked(
_RANGES _Unwrap_iter<_Se>(_STD move(_First)), _RANGES _Unwrap_sent<_It>(_STD move(_Last)));
_STD _Seek_wrapped(_First, _STD move(_UResult));
return _First;
}
template <_No_throw_forward_range _Rng>
requires default_initializable<range_value_t<_Rng>>
static borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) {
auto _UResult = _Uninitialized_value_construct_unchecked(_Ubegin(_Range), _Uend(_Range));
return _RANGES _Rewrap_iterator(_Range, _STD move(_UResult));
}
private:
template <class _It, class _Se>
_NODISCARD static _It _Uninitialized_value_construct_unchecked(_It _OFirst, _Se _OLast) {
_STL_INTERNAL_STATIC_ASSERT(_No_throw_forward_iterator<_It>);
_STL_INTERNAL_STATIC_ASSERT(_No_throw_sentinel_for<_Se, _It>);
_STL_INTERNAL_STATIC_ASSERT(default_initializable<iter_value_t<_It>>);
if constexpr (_Use_memset_value_construct_v<_It>) {
return _STD _Zero_range(_OFirst, _RANGES next(_OFirst, _STD move(_OLast)));
} else {
_Uninitialized_backout _Backout{_STD move(_OFirst)};
while (_Backout._Last != _OLast) {
_Backout._Emplace_back();
}
return _Backout._Release();
}
}
};
_EXPORT_STD inline constexpr _Uninitialized_value_construct_fn uninitialized_value_construct;
} // namespace ranges
#endif // _HAS_CXX20
_EXPORT_STD template <class _NoThrowFwdIt, class _Diff>
_NoThrowFwdIt uninitialized_value_construct_n(_NoThrowFwdIt _First, const _Diff _Count_raw) {
// value-initialize all elements in [_First, _First + _Count)
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (_Count <= 0) {
return _First;
}
_STD _Seek_wrapped(
_First, _STD _Uninitialized_value_construct_n_unchecked1(_STD _Get_unwrapped_n(_First, _Count), _Count));
return _First;
}
_EXPORT_STD template <class _ExPo, class _NoThrowFwdIt, class _Diff, _Enable_if_execution_policy_t<_ExPo> = 0>
_NoThrowFwdIt uninitialized_value_construct_n(
_ExPo&& _Exec, _NoThrowFwdIt _First, _Diff _Count_raw) noexcept; // terminates
#if _HAS_CXX20
namespace ranges {
struct _Uninitialized_value_construct_n_fn {
template <_No_throw_forward_iterator _It>
requires default_initializable<iter_value_t<_It>>
static _It operator()(_It _First, iter_difference_t<_It> _Count) {
if (_Count <= 0) {
return _First;
}
auto _UFirst = _STD _Get_unwrapped_n(_STD move(_First), _Count);
if constexpr (_Use_memset_value_construct_v<_It>) {
_STD _Seek_wrapped(_First, _STD _Zero_range(_UFirst, _UFirst + _Count));
} else {
_Uninitialized_backout _Backout{_STD move(_UFirst)};
for (; _Count > 0; --_Count) {
_Backout._Emplace_back();
}
_STD _Seek_wrapped(_First, _Backout._Release());
}
return _First;
}
};
_EXPORT_STD inline constexpr _Uninitialized_value_construct_n_fn uninitialized_value_construct_n;
} // namespace ranges
#endif // _HAS_CXX20
#endif // _HAS_CXX17
#if _HAS_CXX20
template <class _PtrTy>
_NODISCARD void* _Voidify_unfancy(_PtrTy _Ptr) noexcept {
if constexpr (is_pointer_v<_PtrTy>) {
return _Ptr;
} else {
return _STD addressof(*_Ptr);
}
}
#endif // _HAS_CXX20
#if _HAS_DEPRECATED_RAW_STORAGE_ITERATOR
_EXPORT_STD template <class _OutIt, class _Ty>
class _CXX17_DEPRECATE_RAW_STORAGE_ITERATOR raw_storage_iterator { // wrap stores to raw buffer as output iterator
public:
using iterator_category = output_iterator_tag;
using value_type = void;
#if _HAS_CXX20
using difference_type = ptrdiff_t;
#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv
using difference_type = void;
#endif // ^^^ !_HAS_CXX20 ^^^
using pointer = void;
using reference = void;
explicit raw_storage_iterator(_OutIt _First) : _Next(_First) {}
_NODISCARD raw_storage_iterator& operator*() { // pretend to return designated value
return *this;
}
raw_storage_iterator& operator=(const _Ty& _Val) { // construct value designated by stored iterator
_STD _Construct_in_place(const_cast<_Remove_cvref_t<decltype(*_Next)>&>(*_Next), _Val);
return *this;
}
raw_storage_iterator& operator=(_Ty&& _Val) { // construct value designated by stored iterator
_STD _Construct_in_place(const_cast<_Remove_cvref_t<decltype(*_Next)>&>(*_Next), _STD move(_Val));
return *this;
}
raw_storage_iterator& operator++() {
++_Next;
return *this;
}
raw_storage_iterator operator++(int) {
raw_storage_iterator _Ans = *this;
++_Next;
return _Ans;
}