Christian Trott fcaccf817d [libcxx] Add mdspan/extents
This patch adds std::extents. extents is one of the core classes used by std::mdspan. It describes a multi-dimensional index space with a mix of compile time and runtime sizes. Furthermore, it is templated on the index type used to describe the multi-dimensional index space.

The class is designed to be highly optimizable in performance critical code sections, and is fully useable in constant expressions contexts.

Testing of this class tends to be somewhat combinatorical, due to the large number of possible corner cases involved in situations where we have both runtime and compile time extents. To add to this, the class is designed to be interoperable (in particular constructible) from arguments which only need to be convertible to the index_type, but are otherwise arbitrary user types. For a larger discussion on the design of this class refer to: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r18.html

Co-authored-by: Damien L-G <dalg24@gmail.com>

Reviewed By: ldionne, #libc

Spies: libcxx-commits, H-G-Hristov, tschuett, philnik, arichardson, Mordante, crtrott

Differential Revision: https://reviews.llvm.org/D148067
2023-05-16 14:30:36 -07:00

17 KiB

1algorithm atomic
2algorithm bit
3algorithm climits
4algorithm concepts
5algorithm cstddef
6algorithm cstdint
7algorithm cstdlib
8algorithm cstring
9algorithm ctime
10algorithm execution
11algorithm initializer_list
12algorithm iosfwd
13algorithm iterator
14algorithm limits
15algorithm memory
16algorithm new
17algorithm ratio
18algorithm stdexcept
19algorithm type_traits
20algorithm utility
21algorithm version
22any atomic
23any chrono
24any concepts
25any cstddef
26any cstdint
27any cstdlib
28any cstring
29any initializer_list
30any iosfwd
31any iterator
32any limits
33any memory
34any new
35any stdexcept
36any type_traits
37any typeinfo
38any variant
39any version
40array algorithm
41array compare
42array concepts
43array cstddef
44array cstdlib
45array initializer_list
46array iterator
47array limits
48array stdexcept
49array type_traits
50array utility
51array version
52atomic cmath
53atomic compare
54atomic cstddef
55atomic cstdint
56atomic cstdlib
57atomic cstring
58atomic ctime
59atomic iosfwd
60atomic limits
61atomic ratio
62atomic type_traits
63atomic version
64barrier atomic
65barrier concepts
66barrier cstddef
67barrier cstdint
68barrier cstring
69barrier ctime
70barrier iosfwd
71barrier iterator
72barrier limits
73barrier memory
74barrier new
75barrier ratio
76barrier stdexcept
77barrier type_traits
78barrier variant
79barrier version
80bit cstdint
81bit cstdlib
82bit iosfwd
83bit limits
84bit type_traits
85bit version
86bitset climits
87bitset concepts
88bitset cstddef
89bitset cstdint
90bitset cstdlib
91bitset cstring
92bitset initializer_list
93bitset iosfwd
94bitset limits
95bitset new
96bitset stdexcept
97bitset string
98bitset type_traits
99bitset version
100ccomplex complex
101charconv cerrno
102charconv cmath
103charconv concepts
104charconv cstddef
105charconv cstdint
106charconv cstdlib
107charconv cstring
108charconv initializer_list
109charconv iosfwd
110charconv limits
111charconv type_traits
112chrono bit
113chrono compare
114chrono concepts
115chrono cstddef
116chrono cstdint
117chrono cstdlib
118chrono cstring
119chrono ctime
120chrono limits
121chrono ratio
122chrono stdexcept
123chrono string_view
124chrono tuple
125chrono type_traits
126chrono version
127cinttypes cstdint
128cmath type_traits
129cmath version
130codecvt atomic
131codecvt cctype
132codecvt clocale
133codecvt concepts
134codecvt cstddef
135codecvt cstdint
136codecvt cstdlib
137codecvt cstring
138codecvt cwchar
139codecvt initializer_list
140codecvt iosfwd
141codecvt limits
142codecvt mutex
143codecvt new
144codecvt stdexcept
145codecvt string
146codecvt type_traits
147codecvt typeinfo
148codecvt version
149compare cmath
150compare cstddef
151compare cstdint
152compare limits
153compare type_traits
154compare version
155complex cmath
156complex iosfwd
157complex sstream
158complex stdexcept
159complex type_traits
160complex version
161concepts cstddef
162concepts type_traits
163concepts version
164condition_variable atomic
165condition_variable cerrno
166condition_variable concepts
167condition_variable cstddef
168condition_variable cstdint
169condition_variable cstdlib
170condition_variable cstring
171condition_variable ctime
172condition_variable initializer_list
173condition_variable iosfwd
174condition_variable limits
175condition_variable new
176condition_variable ratio
177condition_variable stdexcept
178condition_variable string
179condition_variable system_error
180condition_variable type_traits
181condition_variable typeinfo
182condition_variable version
183coroutine compare
184coroutine cstddef
185coroutine cstdint
186coroutine cstring
187coroutine iosfwd
188coroutine limits
189coroutine type_traits
190coroutine version
191cstddef version
192ctgmath ccomplex
193ctgmath cmath
194cwchar cwctype
195cwctype cctype
196deque algorithm
197deque atomic
198deque compare
199deque concepts
200deque cstddef
201deque cstdint
202deque cstdlib
203deque cstring
204deque functional
205deque initializer_list
206deque iosfwd
207deque iterator
208deque limits
209deque new
210deque stdexcept
211deque tuple
212deque type_traits
213deque typeinfo
214deque version
215exception cstddef
216exception cstdlib
217exception type_traits
218exception version
219execution cstddef
220execution version
221expected cstddef
222expected initializer_list
223expected new
224expected version
225experimental/deque deque
226experimental/deque experimental/memory_resource
227experimental/forward_list experimental/memory_resource
228experimental/forward_list forward_list
229experimental/iterator cstddef
230experimental/iterator iosfwd
231experimental/iterator iterator
232experimental/iterator type_traits
233experimental/list experimental/memory_resource
234experimental/list list
235experimental/map experimental/memory_resource
236experimental/map map
237experimental/memory_resource atomic
238experimental/memory_resource climits
239experimental/memory_resource concepts
240experimental/memory_resource cstddef
241experimental/memory_resource cstdlib
242experimental/memory_resource cstring
243experimental/memory_resource ctime
244experimental/memory_resource experimental/utility
245experimental/memory_resource iterator
246experimental/memory_resource limits
247experimental/memory_resource memory
248experimental/memory_resource new
249experimental/memory_resource ratio
250experimental/memory_resource stdexcept
251experimental/memory_resource tuple
252experimental/memory_resource type_traits
253experimental/memory_resource variant
254experimental/propagate_const cstddef
255experimental/propagate_const type_traits
256experimental/regex experimental/memory_resource
257experimental/regex experimental/string
258experimental/regex regex
259experimental/set experimental/memory_resource
260experimental/set set
261experimental/simd algorithm
262experimental/simd array
263experimental/simd cstddef
264experimental/simd functional
265experimental/simd tuple
266experimental/string experimental/memory_resource
267experimental/string string
268experimental/type_traits initializer_list
269experimental/type_traits type_traits
270experimental/unordered_map algorithm
271experimental/unordered_map array
272experimental/unordered_map bit
273experimental/unordered_map experimental/memory_resource
274experimental/unordered_map functional
275experimental/unordered_map unordered_map
276experimental/unordered_map vector
277experimental/unordered_set experimental/memory_resource
278experimental/unordered_set unordered_set
279experimental/utility utility
280experimental/vector experimental/memory_resource
281experimental/vector vector
282filesystem compare
283filesystem concepts
284filesystem cstddef
285filesystem cstdint
286filesystem cstdlib
287filesystem ctime
288filesystem iomanip
289filesystem iosfwd
290filesystem limits
291filesystem locale
292filesystem new
293filesystem ratio
294filesystem string
295filesystem string_view
296filesystem system_error
297filesystem type_traits
298filesystem version
299format array
300format cmath
301format cstddef
302format cstdint
303format cstdlib
304format initializer_list
305format limits
306format locale
307format optional
308format queue
309format stack
310format stdexcept
311format string
312format string_view
313format tuple
314format version
315forward_list algorithm
316forward_list atomic
317forward_list compare
318forward_list concepts
319forward_list cstddef
320forward_list cstdint
321forward_list cstdlib
322forward_list cstring
323forward_list functional
324forward_list initializer_list
325forward_list iosfwd
326forward_list iterator
327forward_list limits
328forward_list new
329forward_list stdexcept
330forward_list tuple
331forward_list type_traits
332forward_list typeinfo
333forward_list version
334fstream atomic
335fstream cctype
336fstream clocale
337fstream concepts
338fstream cstddef
339fstream cstdint
340fstream cstdio
341fstream cstdlib
342fstream cstring
343fstream cwchar
344fstream filesystem
345fstream initializer_list
346fstream iosfwd
347fstream istream
348fstream limits
349fstream mutex
350fstream new
351fstream ostream
352fstream stdexcept
353fstream string
354fstream type_traits
355fstream typeinfo
356fstream version
357functional array
358functional atomic
359functional concepts
360functional cstddef
361functional cstdint
362functional cstdlib
363functional cstring
364functional exception
365functional initializer_list
366functional iosfwd
367functional limits
368functional memory
369functional new
370functional stdexcept
371functional tuple
372functional type_traits
373functional typeinfo
374functional unordered_map
375functional utility
376functional vector
377functional version
378future atomic
379future cerrno
380future chrono
381future cstddef
382future cstdint
383future cstdlib
384future cstring
385future exception
386future initializer_list
387future iosfwd
388future limits
389future mutex
390future new
391future ratio
392future stdexcept
393future string
394future system_error
395future thread
396future type_traits
397future typeinfo
398future version
399initializer_list cstddef
400iomanip istream
401iomanip version
402ios atomic
403ios cctype
404ios clocale
405ios concepts
406ios cstddef
407ios cstdint
408ios cstdlib
409ios cstring
410ios cwchar
411ios initializer_list
412ios iosfwd
413ios limits
414ios mutex
415ios new
416ios stdexcept
417ios string
418ios system_error
419ios type_traits
420ios typeinfo
421ios version
422iosfwd version
423iostream ios
424iostream istream
425iostream ostream
426iostream streambuf
427iostream version
428istream concepts
429istream cstddef
430istream iosfwd
431istream ostream
432istream type_traits
433istream version
434iterator compare
435iterator concepts
436iterator cstddef
437iterator cstdlib
438iterator exception
439iterator initializer_list
440iterator iosfwd
441iterator limits
442iterator new
443iterator type_traits
444iterator typeinfo
445iterator utility
446iterator variant
447iterator version
448latch atomic
449latch cstddef
450latch cstdint
451latch cstring
452latch ctime
453latch iosfwd
454latch limits
455latch ratio
456latch type_traits
457latch version
458limits type_traits
459limits version
460list algorithm
461list atomic
462list compare
463list concepts
464list cstddef
465list cstdint
466list cstdlib
467list cstring
468list functional
469list initializer_list
470list iosfwd
471list iterator
472list limits
473list new
474list stdexcept
475list tuple
476list type_traits
477list typeinfo
478list version
479locale atomic
480locale cctype
481locale cerrno
482locale clocale
483locale concepts
484locale cstdarg
485locale cstddef
486locale cstdint
487locale cstdio
488locale cstdlib
489locale cstring
490locale ctime
491locale cwchar
492locale initializer_list
493locale ios
494locale iosfwd
495locale iterator
496locale limits
497locale mutex
498locale new
499locale stdexcept
500locale streambuf
501locale string
502locale type_traits
503locale typeinfo
504locale version
505map compare
506map concepts
507map cstddef
508map cstdlib
509map functional
510map initializer_list
511map iterator
512map limits
513map new
514map optional
515map stdexcept
516map tuple
517map type_traits
518map utility
519map version
520mdspan array
521mdspan cinttypes
522mdspan concepts
523mdspan cstddef
524mdspan limits
525mdspan span
526memory atomic
527memory compare
528memory concepts
529memory cstddef
530memory cstdint
531memory cstdlib
532memory cstring
533memory initializer_list
534memory iosfwd
535memory iterator
536memory limits
537memory new
538memory stdexcept
539memory tuple
540memory type_traits
541memory typeinfo
542memory utility
543memory version
544memory_resource cstddef
545memory_resource cstdint
546memory_resource limits
547memory_resource mutex
548memory_resource new
549memory_resource stdexcept
550memory_resource tuple
551memory_resource version
552mutex atomic
553mutex cerrno
554mutex concepts
555mutex cstddef
556mutex cstdint
557mutex cstdlib
558mutex cstring
559mutex ctime
560mutex initializer_list
561mutex iosfwd
562mutex limits
563mutex new
564mutex ratio
565mutex stdexcept
566mutex string
567mutex system_error
568mutex tuple
569mutex type_traits
570mutex typeinfo
571mutex version
572new cstddef
573new cstdlib
574new exception
575new type_traits
576new version
577numbers concepts
578numbers type_traits
579numbers version
580numeric cmath
581numeric concepts
582numeric cstddef
583numeric functional
584numeric iterator
585numeric limits
586numeric type_traits
587numeric version
588optional atomic
589optional climits
590optional compare
591optional concepts
592optional cstddef
593optional cstdint
594optional cstring
595optional ctime
596optional initializer_list
597optional iterator
598optional limits
599optional memory
600optional new
601optional ratio
602optional stdexcept
603optional tuple
604optional type_traits
605optional typeinfo
606optional utility
607optional variant
608optional version
609ostream atomic
610ostream bitset
611ostream cerrno
612ostream concepts
613ostream cstddef
614ostream cstdint
615ostream cstdlib
616ostream cstring
617ostream initializer_list
618ostream ios
619ostream iosfwd
620ostream iterator
621ostream limits
622ostream locale
623ostream new
624ostream stdexcept
625ostream streambuf
626ostream string
627ostream type_traits
628ostream typeinfo
629ostream version
630queue compare
631queue concepts
632queue cstddef
633queue cstdlib
634queue deque
635queue functional
636queue initializer_list
637queue limits
638queue type_traits
639queue vector
640queue version
641random algorithm
642random climits
643random cmath
644random concepts
645random cstddef
646random cstdint
647random cstdlib
648random initializer_list
649random iosfwd
650random limits
651random numeric
652random string
653random type_traits
654random vector
655random version
656ranges compare
657ranges cstddef
658ranges cstdlib
659ranges initializer_list
660ranges iosfwd
661ranges iterator
662ranges limits
663ranges optional
664ranges span
665ranges tuple
666ranges type_traits
667ranges variant
668ranges version
669ratio climits
670ratio cstdint
671ratio type_traits
672ratio version
673regex atomic
674regex cctype
675regex clocale
676regex compare
677regex concepts
678regex cstddef
679regex cstdint
680regex cstdlib
681regex cstring
682regex cwchar
683regex deque
684regex initializer_list
685regex iosfwd
686regex iterator
687regex limits
688regex mutex
689regex new
690regex stdexcept
691regex string
692regex type_traits
693regex typeinfo
694regex utility
695regex vector
696regex version
697scoped_allocator atomic
698scoped_allocator climits
699scoped_allocator concepts
700scoped_allocator cstddef
701scoped_allocator cstring
702scoped_allocator ctime
703scoped_allocator iterator
704scoped_allocator limits
705scoped_allocator memory
706scoped_allocator new
707scoped_allocator ratio
708scoped_allocator stdexcept
709scoped_allocator tuple
710scoped_allocator type_traits
711scoped_allocator variant
712scoped_allocator version
713semaphore atomic
714semaphore cstddef
715semaphore cstdint
716semaphore cstring
717semaphore ctime
718semaphore iosfwd
719semaphore limits
720semaphore ratio
721semaphore type_traits
722semaphore version
723set compare
724set concepts
725set cstddef
726set cstdlib
727set functional
728set initializer_list
729set iterator
730set limits
731set new
732set optional
733set stdexcept
734set tuple
735set type_traits
736set version
737shared_mutex cerrno
738shared_mutex cstddef
739shared_mutex ctime
740shared_mutex iosfwd
741shared_mutex limits
742shared_mutex ratio
743shared_mutex stdexcept
744shared_mutex string
745shared_mutex system_error
746shared_mutex type_traits
747shared_mutex version
748source_location cstdint
749source_location version
750span array
751span concepts
752span cstddef
753span functional
754span initializer_list
755span iterator
756span limits
757span type_traits
758span version
759sstream cstddef
760sstream istream
761sstream ostream
762sstream string
763sstream type_traits
764sstream version
765stack compare
766stack concepts
767stack cstddef
768stack deque
769stack functional
770stack initializer_list
771stack type_traits
772stack version
773stdexcept cstdlib
774stdexcept exception
775stdexcept iosfwd
776streambuf cstdint
777streambuf ios
778streambuf iosfwd
779streambuf version
780string algorithm
781string climits
782string compare
783string concepts
784string cstddef
785string cstdint
786string cstdio
787string cstdlib
788string cstring
789string cwchar
790string initializer_list
791string iosfwd
792string iterator
793string limits
794string new
795string stdexcept
796string string_view
797string tuple
798string type_traits
799string typeinfo
800string utility
801string version
802string_view algorithm
803string_view compare
804string_view concepts
805string_view cstddef
806string_view cstdint
807string_view cstdio
808string_view cstdlib
809string_view cstring
810string_view cwchar
811string_view initializer_list
812string_view iosfwd
813string_view iterator
814string_view limits
815string_view stdexcept
816string_view type_traits
817string_view version
818strstream istream
819strstream ostream
820strstream version
821system_error cerrno
822system_error compare
823system_error cstddef
824system_error cstdint
825system_error cstring
826system_error limits
827system_error stdexcept
828system_error string
829system_error type_traits
830system_error version
831thread array
832thread cerrno
833thread chrono
834thread compare
835thread cstddef
836thread cstdint
837thread cstdlib
838thread cstring
839thread ctime
840thread functional
841thread iosfwd
842thread limits
843thread locale
844thread new
845thread ratio
846thread stdexcept
847thread string
848thread string_view
849thread system_error
850thread tuple
851thread type_traits
852thread version
853tuple compare
854tuple cstddef
855tuple exception
856tuple iosfwd
857tuple new
858tuple type_traits
859tuple typeinfo
860tuple utility
861tuple version
862type_traits cstddef
863type_traits cstdint
864type_traits version
865typeindex compare
866typeindex iosfwd
867typeindex new
868typeindex typeinfo
869typeindex utility
870typeindex version
871typeinfo cstddef
872typeinfo cstdint
873typeinfo cstdlib
874typeinfo exception
875typeinfo type_traits
876unordered_map algorithm
877unordered_map bit
878unordered_map cmath
879unordered_map compare
880unordered_map concepts
881unordered_map cstddef
882unordered_map cstdint
883unordered_map cstdlib
884unordered_map cstring
885unordered_map initializer_list
886unordered_map iterator
887unordered_map limits
888unordered_map new
889unordered_map optional
890unordered_map stdexcept
891unordered_map tuple
892unordered_map type_traits
893unordered_map version
894unordered_set cmath
895unordered_set compare
896unordered_set concepts
897unordered_set cstddef
898unordered_set cstdint
899unordered_set cstdlib
900unordered_set cstring
901unordered_set functional
902unordered_set initializer_list
903unordered_set iterator
904unordered_set limits
905unordered_set new
906unordered_set optional
907unordered_set stdexcept
908unordered_set tuple
909unordered_set type_traits
910unordered_set version
911utility compare
912utility cstddef
913utility cstdlib
914utility initializer_list
915utility iosfwd
916utility limits
917utility type_traits
918utility version
919valarray algorithm
920valarray cmath
921valarray concepts
922valarray cstddef
923valarray cstdlib
924valarray cstring
925valarray functional
926valarray initializer_list
927valarray limits
928valarray new
929valarray stdexcept
930valarray type_traits
931valarray version
932variant compare
933variant cstddef
934variant cstdint
935variant cstring
936variant exception
937variant initializer_list
938variant limits
939variant new
940variant tuple
941variant type_traits
942variant typeinfo
943variant utility
944variant version
945vector algorithm
946vector array
947vector atomic
948vector cerrno
949vector climits
950vector compare
951vector concepts
952vector cstddef
953vector cstdint
954vector cstdlib
955vector cstring
956vector initializer_list
957vector iosfwd
958vector limits
959vector locale
960vector new
961vector stdexcept
962vector string
963vector string_view
964vector tuple
965vector type_traits
966vector typeinfo
967vector utility
968vector version