-
Notifications
You must be signed in to change notification settings - Fork 108
/
gsl-lite.hpp
5549 lines (4673 loc) · 192 KB
/
gsl-lite.hpp
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
//
// gsl-lite is based on GSL: Guidelines Support Library.
// For more information see https://github.com/gsl-lite/gsl-lite
//
// Copyright (c) 2015-2019 Martin Moene
// Copyright (c) 2019-2023 Moritz Beutel
// Copyright (c) 2015-2018 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#ifndef GSL_GSL_LITE_HPP_INCLUDED
#define GSL_GSL_LITE_HPP_INCLUDED
#include <exception> // for exception, terminate(), uncaught_exceptions()
#include <limits>
#include <memory> // for addressof(), unique_ptr<>, shared_ptr<>
#include <iosfwd> // for basic_ostream<>
#include <ios> // for ios_base, streamsize
#include <stdexcept> // for logic_error
#include <string>
#include <utility> // for move(), forward<>(), swap()
#include <cstddef> // for size_t, ptrdiff_t, nullptr_t
#include <cstdlib> // for abort()
#define gsl_lite_MAJOR 0
#define gsl_lite_MINOR 41
#define gsl_lite_PATCH 0
#define gsl_lite_VERSION gsl_STRINGIFY(gsl_lite_MAJOR) "." gsl_STRINGIFY(gsl_lite_MINOR) "." gsl_STRINGIFY(gsl_lite_PATCH)
#define gsl_STRINGIFY( x ) gsl_STRINGIFY_( x )
#define gsl_STRINGIFY_( x ) #x
#define gsl_CONCAT_( a, b ) gsl_CONCAT2_( a, b )
#define gsl_CONCAT2_( a, b ) a##b
#define gsl_EVALF_( f ) f()
// configuration argument checking:
#define gsl_DETAIL_CFG_TOGGLE_VALUE_1 1
#define gsl_DETAIL_CFG_TOGGLE_VALUE_0 1
#define gsl_DETAIL_CFG_DEFAULTS_VERSION_VALUE_1 1
#define gsl_DETAIL_CFG_DEFAULTS_VERSION_VALUE_0 1
#define gsl_DETAIL_CFG_STD_VALUE_98 1
#define gsl_DETAIL_CFG_STD_VALUE_3 1
#define gsl_DETAIL_CFG_STD_VALUE_03 1
#define gsl_DETAIL_CFG_STD_VALUE_11 1
#define gsl_DETAIL_CFG_STD_VALUE_14 1
#define gsl_DETAIL_CFG_STD_VALUE_17 1
#define gsl_DETAIL_CFG_STD_VALUE_20 1
#define gsl_DETAIL_CFG_NO_VALUE_ 1
#define gsl_DETAIL_CFG_NO_VALUE_1 1 // many compilers treat the command-line parameter "-Dfoo" as equivalent to "-Dfoo=1", so we tolerate that
#define gsl_CHECK_CFG_TOGGLE_VALUE_( x ) gsl_CONCAT_( gsl_DETAIL_CFG_TOGGLE_VALUE_, x )
#define gsl_CHECK_CFG_DEFAULTS_VERSION_VALUE_( x ) gsl_CONCAT_( gsl_DETAIL_CFG_DEFAULTS_VERSION_VALUE_, x )
#define gsl_CHECK_CFG_STD_VALUE_( x ) gsl_CONCAT_( gsl_DETAIL_CFG_STD_VALUE_, x )
#define gsl_CHECK_CFG_NO_VALUE_( x ) gsl_CONCAT_( gsl_DETAIL_CFG_NO_VALUE, gsl_CONCAT_( _, x ) )
// gsl-lite backward compatibility:
#if defined( gsl_CONFIG_DEFAULTS_VERSION )
# if ! gsl_CHECK_CFG_DEFAULTS_VERSION_VALUE_( gsl_CONFIG_DEFAULTS_VERSION )
# pragma message ("invalid configuration value gsl_CONFIG_DEFAULTS_VERSION=" gsl_STRINGIFY(gsl_CONFIG_DEFAULTS_VERSION) ", must be 0 or 1")
# endif
#else
# define gsl_CONFIG_DEFAULTS_VERSION gsl_lite_MAJOR // default
#endif
# define gsl_CONFIG_DEFAULTS_VERSION_() gsl_CONFIG_DEFAULTS_VERSION
#if defined( gsl_CONFIG_ALLOWS_SPAN_CONTAINER_CTOR )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_CONFIG_ALLOWS_SPAN_CONTAINER_CTOR )
# pragma message ("invalid configuration value gsl_CONFIG_ALLOWS_SPAN_CONTAINER_CTOR=" gsl_STRINGIFY(gsl_CONFIG_ALLOWS_SPAN_CONTAINER_CTOR) ", must be 0 or 1")
# endif
# define gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR gsl_CONFIG_ALLOWS_SPAN_CONTAINER_CTOR
# pragma message ("gsl_CONFIG_ALLOWS_SPAN_CONTAINER_CTOR is deprecated since gsl-lite 0.7; replace with gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR, or consider span(with_container, cont).")
#endif
#if defined( gsl_CONFIG_CONTRACT_LEVEL_ON )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_LEVEL_ON )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_LEVEL_ON=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_LEVEL_ON) "; macro must be defined without value")
# endif
# pragma message ("gsl_CONFIG_CONTRACT_LEVEL_ON is deprecated since gsl-lite 0.36; replace with gsl_CONFIG_CONTRACT_CHECKING_ON.")
# define gsl_CONFIG_CONTRACT_CHECKING_ON
#endif
#if defined( gsl_CONFIG_CONTRACT_LEVEL_OFF )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_LEVEL_OFF )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_LEVEL_OFF=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_LEVEL_OFF) "; macro must be defined without value")
# endif
# pragma message ("gsl_CONFIG_CONTRACT_LEVEL_OFF is deprecated since gsl-lite 0.36; replace with gsl_CONFIG_CONTRACT_CHECKING_OFF.")
# define gsl_CONFIG_CONTRACT_CHECKING_OFF
#endif
#if defined( gsl_CONFIG_CONTRACT_LEVEL_EXPECTS_ONLY )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_LEVEL_EXPECTS_ONLY )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_LEVEL_EXPECTS_ONLY=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_LEVEL_EXPECTS_ONLY) "; macro must be defined without value")
# endif
# pragma message ("gsl_CONFIG_CONTRACT_LEVEL_EXPECTS_ONLY is deprecated since gsl-lite 0.36; replace with gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF and gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF.")
# define gsl_CONFIG_CONTRACT_CHECKING_ON
# define gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF
# define gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF
#elif defined( gsl_CONFIG_CONTRACT_LEVEL_ENSURES_ONLY )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_LEVEL_ENSURES_ONLY )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_LEVEL_ENSURES_ONLY=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_LEVEL_ENSURES_ONLY) "; macro must be defined without value")
# endif
# pragma message ("gsl_CONFIG_CONTRACT_LEVEL_ENSURES_ONLY is deprecated since gsl-lite 0.36; replace with gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF and gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF.")
# define gsl_CONFIG_CONTRACT_CHECKING_ON
# define gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF
# define gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF
#endif
// M-GSL compatibility:
#if defined( GSL_THROW_ON_CONTRACT_VIOLATION )
# if ! gsl_CHECK_CFG_NO_VALUE_( GSL_THROW_ON_CONTRACT_VIOLATION )
# pragma message ("invalid configuration value GSL_THROW_ON_CONTRACT_VIOLATION=" gsl_STRINGIFY(GSL_THROW_ON_CONTRACT_VIOLATION) "; macro must be defined without value")
# endif
# define gsl_CONFIG_CONTRACT_VIOLATION_THROWS
#endif
#if defined( GSL_TERMINATE_ON_CONTRACT_VIOLATION )
# if ! gsl_CHECK_CFG_NO_VALUE_( GSL_TERMINATE_ON_CONTRACT_VIOLATION )
# pragma message ("invalid configuration value GSL_TERMINATE_ON_CONTRACT_VIOLATION=" gsl_STRINGIFY(GSL_TERMINATE_ON_CONTRACT_VIOLATION) "; macro must be defined without value")
# endif
# define gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES
#endif
#if defined( GSL_UNENFORCED_ON_CONTRACT_VIOLATION )
# if ! gsl_CHECK_CFG_NO_VALUE_( GSL_UNENFORCED_ON_CONTRACT_VIOLATION )
# pragma message ("invalid configuration value GSL_UNENFORCED_ON_CONTRACT_VIOLATION=" gsl_STRINGIFY(GSL_UNENFORCED_ON_CONTRACT_VIOLATION) "; macro must be defined without value")
# endif
# define gsl_CONFIG_CONTRACT_CHECKING_OFF
#endif
// Configuration: Features
#if defined( gsl_FEATURE_WITH_CONTAINER_TO_STD )
# if ! gsl_CHECK_CFG_STD_VALUE_( gsl_FEATURE_WITH_CONTAINER_TO_STD )
# pragma message ("invalid configuration value gsl_FEATURE_WITH_CONTAINER_TO_STD=" gsl_STRINGIFY(gsl_FEATURE_WITH_CONTAINER_TO_STD) ", must be 98, 3, 11, 14, 17, or 20")
# endif
#else
# define gsl_FEATURE_WITH_CONTAINER_TO_STD 99 // default
#endif
#define gsl_FEATURE_WITH_CONTAINER_TO_STD_() gsl_FEATURE_WITH_CONTAINER_TO_STD
#if defined( gsl_FEATURE_MAKE_SPAN_TO_STD )
# if ! gsl_CHECK_CFG_STD_VALUE_( gsl_FEATURE_MAKE_SPAN_TO_STD )
# pragma message ("invalid configuration value gsl_FEATURE_MAKE_SPAN_TO_STD=" gsl_STRINGIFY(gsl_FEATURE_MAKE_SPAN_TO_STD) ", must be 98, 3, 11, 14, 17, or 20")
# endif
#else
# define gsl_FEATURE_MAKE_SPAN_TO_STD 99 // default
#endif
#define gsl_FEATURE_MAKE_SPAN_TO_STD_() gsl_FEATURE_MAKE_SPAN_TO_STD
#if defined( gsl_FEATURE_BYTE_SPAN_TO_STD )
# if ! gsl_CHECK_CFG_STD_VALUE_( gsl_FEATURE_BYTE_SPAN_TO_STD )
# pragma message ("invalid configuration value gsl_FEATURE_BYTE_SPAN_TO_STD=" gsl_STRINGIFY(gsl_FEATURE_BYTE_SPAN_TO_STD) ", must be 98, 3, 11, 14, 17, or 20")
# endif
#else
# define gsl_FEATURE_BYTE_SPAN_TO_STD 99 // default
#endif
#define gsl_FEATURE_BYTE_SPAN_TO_STD_() gsl_FEATURE_BYTE_SPAN_TO_STD
#if defined( gsl_FEATURE_IMPLICIT_MACRO )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_FEATURE_IMPLICIT_MACRO )
# pragma message ("invalid configuration value gsl_FEATURE_IMPLICIT_MACRO=" gsl_STRINGIFY(gsl_FEATURE_IMPLICIT_MACRO) ", must be 0 or 1")
# endif
#else
# define gsl_FEATURE_IMPLICIT_MACRO 0 // default
#endif
#define gsl_FEATURE_IMPLICIT_MACRO_() gsl_FEATURE_IMPLICIT_MACRO
#if defined( gsl_FEATURE_OWNER_MACRO )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_FEATURE_OWNER_MACRO )
# pragma message ("invalid configuration value gsl_FEATURE_OWNER_MACRO=" gsl_STRINGIFY(gsl_FEATURE_OWNER_MACRO) ", must be 0 or 1")
# endif
#else
# define gsl_FEATURE_OWNER_MACRO (gsl_CONFIG_DEFAULTS_VERSION == 0) // default
#endif
#define gsl_FEATURE_OWNER_MACRO_() gsl_FEATURE_OWNER_MACRO
//#if defined( gsl_FEATURE_STRING_SPAN )
//# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_FEATURE_STRING_SPAN )
//# pragma message ("invalid configuration value gsl_FEATURE_STRING_SPAN=" gsl_STRINGIFY(gsl_FEATURE_STRING_SPAN) ", must be 0 or 1")
//# endif
//#else
//# define gsl_FEATURE_STRING_SPAN (gsl_CONFIG_DEFAULTS_VERSION == 0) // default
//#endif
//#define gsl_FEATURE_STRING_SPAN_() gsl_FEATURE_STRING_SPAN
#if defined( gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD )
# pragma message ("invalid configuration value gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD=" gsl_STRINGIFY(gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD) ", must be 0 or 1")
# endif
#else
# define gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD 0 // default
#endif
# define gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD_() gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD
#if defined( gsl_FEATURE_GSL_LITE_NAMESPACE )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_FEATURE_GSL_LITE_NAMESPACE )
# pragma message ("invalid configuration value gsl_FEATURE_GSL_LITE_NAMESPACE=" gsl_STRINGIFY(gsl_FEATURE_GSL_LITE_NAMESPACE) ", must be 0 or 1")
# endif
#else
# define gsl_FEATURE_GSL_LITE_NAMESPACE (gsl_CONFIG_DEFAULTS_VERSION >= 1) // default
#endif
#define gsl_FEATURE_GSL_LITE_NAMESPACE_() gsl_FEATURE_GSL_LITE_NAMESPACE
// Configuration: Other
#if defined( gsl_CONFIG_TRANSPARENT_NOT_NULL )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_CONFIG_TRANSPARENT_NOT_NULL )
# pragma message ("invalid configuration value gsl_CONFIG_TRANSPARENT_NOT_NULL=" gsl_STRINGIFY(gsl_CONFIG_TRANSPARENT_NOT_NULL) ", must be 0 or 1")
# endif
# if gsl_CONFIG_TRANSPARENT_NOT_NULL && defined( gsl_CONFIG_NOT_NULL_GET_BY_CONST_REF )
# error configuration option gsl_CONFIG_NOT_NULL_GET_BY_CONST_REF is meaningless if gsl_CONFIG_TRANSPARENT_NOT_NULL=1
# endif
#else
# define gsl_CONFIG_TRANSPARENT_NOT_NULL (gsl_CONFIG_DEFAULTS_VERSION >= 1) // default
#endif
# define gsl_CONFIG_TRANSPARENT_NOT_NULL_() gsl_CONFIG_TRANSPARENT_NOT_NULL
#if ! defined( gsl_CONFIG_DEPRECATE_TO_LEVEL )
# if gsl_CONFIG_DEFAULTS_VERSION >= 1
# define gsl_CONFIG_DEPRECATE_TO_LEVEL 7
# else
# define gsl_CONFIG_DEPRECATE_TO_LEVEL 0
# endif
#endif
#if ! defined( gsl_CONFIG_SPAN_INDEX_TYPE )
# define gsl_CONFIG_SPAN_INDEX_TYPE std::size_t
#endif
# define gsl_CONFIG_SPAN_INDEX_TYPE_() gsl_CONFIG_SPAN_INDEX_TYPE
#if ! defined( gsl_CONFIG_INDEX_TYPE )
# if gsl_CONFIG_DEFAULTS_VERSION >= 1
// p0122r3 uses std::ptrdiff_t
# define gsl_CONFIG_INDEX_TYPE std::ptrdiff_t
# else
# define gsl_CONFIG_INDEX_TYPE gsl_CONFIG_SPAN_INDEX_TYPE
# endif
#endif
# define gsl_CONFIG_INDEX_TYPE_() gsl_CONFIG_INDEX_TYPE
#if defined( gsl_CONFIG_NOT_NULL_EXPLICIT_CTOR )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_CONFIG_NOT_NULL_EXPLICIT_CTOR )
# pragma message ("invalid configuration value gsl_CONFIG_NOT_NULL_EXPLICIT_CTOR=" gsl_STRINGIFY(gsl_CONFIG_NOT_NULL_EXPLICIT_CTOR) ", must be 0 or 1")
# endif
#else
# define gsl_CONFIG_NOT_NULL_EXPLICIT_CTOR (gsl_CONFIG_DEFAULTS_VERSION >= 1) // default
#endif
#define gsl_CONFIG_NOT_NULL_EXPLICIT_CTOR_() gsl_CONFIG_NOT_NULL_EXPLICIT_CTOR
#if defined( gsl_CONFIG_NOT_NULL_GET_BY_CONST_REF )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_CONFIG_NOT_NULL_GET_BY_CONST_REF )
# pragma message ("invalid configuration value gsl_CONFIG_NOT_NULL_GET_BY_CONST_REF=" gsl_STRINGIFY(gsl_CONFIG_NOT_NULL_GET_BY_CONST_REF) ", must be 0 or 1")
# endif
#else
# define gsl_CONFIG_NOT_NULL_GET_BY_CONST_REF 0 // default
#endif
#define gsl_CONFIG_NOT_NULL_GET_BY_CONST_REF_() gsl_CONFIG_NOT_NULL_GET_BY_CONST_REF
#if defined( gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS )
# pragma message ("invalid configuration value gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS=" gsl_STRINGIFY(gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) ", must be 0 or 1")
# endif
#else
# define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS 0 // default
#endif
#define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS_() gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS
#if defined( gsl_CONFIG_ALLOWS_SPAN_COMPARISON )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_CONFIG_ALLOWS_SPAN_COMPARISON )
# pragma message ("invalid configuration value gsl_CONFIG_ALLOWS_SPAN_COMPARISON=" gsl_STRINGIFY(gsl_CONFIG_ALLOWS_SPAN_COMPARISON) ", must be 0 or 1")
# endif
#else
# define gsl_CONFIG_ALLOWS_SPAN_COMPARISON (gsl_CONFIG_DEFAULTS_VERSION == 0) // default
#endif
#define gsl_CONFIG_ALLOWS_SPAN_COMPARISON_() gsl_CONFIG_ALLOWS_SPAN_COMPARISON
#if defined( gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON )
# pragma message ("invalid configuration value gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON=" gsl_STRINGIFY(gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON) ", must be 0 or 1")
# endif
#else
# define gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON 1 // default
#endif
#define gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON_() gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON
#if defined( gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR )
# pragma message ("invalid configuration value gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR=" gsl_STRINGIFY(gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR) ", must be 0 or 1")
# endif
#else
# define gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR 0 // default
#endif
#define gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR_() gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR
#if defined( gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION )
# pragma message ("invalid configuration value gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION=" gsl_STRINGIFY(gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION) ", must be 0 or 1")
# endif
#else
# define gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION (gsl_CONFIG_DEFAULTS_VERSION >= 1) // default
#endif
#define gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION_() gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION
#if defined( gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS )
# if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS )
# pragma message ("invalid configuration value gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS=" gsl_STRINGIFY(gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS) ", must be 0 or 1")
# endif
#else
# define gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS 1 // default
#endif
#define gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS_() gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS
#if defined( gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_CHECKING_ENSURES_OFF) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_CHECKING_ASSERT_OFF) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_CONTRACT_CHECKING_AUDIT )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_CHECKING_AUDIT )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_CHECKING_AUDIT=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_CHECKING_AUDIT) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_CONTRACT_CHECKING_ON )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_CHECKING_ON )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_CHECKING_ON=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_CHECKING_ON) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_CONTRACT_CHECKING_OFF )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_CHECKING_OFF )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_CHECKING_OFF=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_CHECKING_OFF) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT )
# pragma message ("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON )
# pragma message ("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF )
# pragma message ("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_CONTRACT_VIOLATION_THROWS )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_VIOLATION_THROWS )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_VIOLATION_THROWS=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_CONTRACT_VIOLATION_TRAPS )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_VIOLATION_TRAPS )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_VIOLATION_TRAPS=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_VIOLATION_TRAPS) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER )
# pragma message ("invalid configuration value gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS )
# pragma message ("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS )
# pragma message ("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER )
# pragma message ("invalid configuration value gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME )
# pragma message ("invalid configuration value gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME=" gsl_STRINGIFY(gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE )
# pragma message ("invalid configuration value gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE=" gsl_STRINGIFY(gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME )
# pragma message ("invalid configuration value gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE )
# if ! gsl_CHECK_CFG_NO_VALUE_( gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE )
# pragma message ("invalid configuration value gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE=" gsl_STRINGIFY(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE) "; macro must be defined without value")
# endif
#endif
#if defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_THROWS )
# error cannot use gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_THROWS because exceptions are not supported in device code; use gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS or gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS
#endif
#if defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TERMINATES )
# error gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TERMINATES is not supported; use gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS or gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS
#endif
#if 1 < defined( gsl_CONFIG_CONTRACT_CHECKING_AUDIT ) + defined( gsl_CONFIG_CONTRACT_CHECKING_ON ) + defined( gsl_CONFIG_CONTRACT_CHECKING_OFF )
# error only one of gsl_CONFIG_CONTRACT_CHECKING_AUDIT, gsl_CONFIG_CONTRACT_CHECKING_ON, and gsl_CONFIG_CONTRACT_CHECKING_OFF may be defined
#endif
#if 1 < defined( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT ) + defined( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON ) + defined( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF )
# error only one of gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT, gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON, and gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF may be defined
#endif
#if 1 < defined( gsl_CONFIG_CONTRACT_VIOLATION_THROWS ) + defined( gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES ) + defined( gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS ) + defined( gsl_CONFIG_CONTRACT_VIOLATION_TRAPS ) + defined( gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER )
# error only one of gsl_CONFIG_CONTRACT_VIOLATION_THROWS, gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES, gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS, gsl_CONFIG_CONTRACT_VIOLATION_TRAPS, and gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER may be defined
#endif
#if 1 < defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS ) + defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS ) + defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER )
# error only one of gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS, gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS, and gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER may be defined
#endif
#if 1 < defined( gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME ) + defined( gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE )
# error only one of gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME and gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE may be defined
#endif
#if 1 < defined( gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME ) + defined( gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE )
# error only one of gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME and gsl_CONFIG_UNENFORCED_DEVICE_CONTRACTS_ELIDE may be defined
#endif
#if 0 == defined( gsl_CONFIG_CONTRACT_CHECKING_AUDIT ) + defined( gsl_CONFIG_CONTRACT_CHECKING_ON ) + defined( gsl_CONFIG_CONTRACT_CHECKING_OFF )
// select default
# define gsl_CONFIG_CONTRACT_CHECKING_ON
#endif
#if 0 == defined( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT ) + defined( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON ) + defined( gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF )
// select default
# if defined( gsl_CONFIG_CONTRACT_CHECKING_AUDIT )
# define gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT
# elif defined( gsl_CONFIG_CONTRACT_CHECKING_OFF )
# define gsl_CONFIG_DEVICE_CONTRACT_CHECKING_OFF
# else
# define gsl_CONFIG_DEVICE_CONTRACT_CHECKING_ON
# endif
#endif
#if 0 == defined( gsl_CONFIG_CONTRACT_VIOLATION_THROWS ) + defined( gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES ) + defined( gsl_CONFIG_CONTRACT_VIOLATION_ASSERTS ) + defined( gsl_CONFIG_CONTRACT_VIOLATION_TRAPS ) + defined( gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER )
// select default
# define gsl_CONFIG_CONTRACT_VIOLATION_TERMINATES
#endif
#if 0 == defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS ) + defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS ) + defined( gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER )
// select default
# if defined( gsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER )
# define gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_CALLS_HANDLER
# elif defined( gsl_CONFIG_CONTRACT_VIOLATION_TRAPS )
# define gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_TRAPS
# else
# define gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS
# endif
#endif
#if 0 == defined( gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME ) + defined( gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE )
// select default
# define gsl_CONFIG_UNENFORCED_CONTRACTS_ELIDE
#endif
#if 0 == defined( gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME ) + defined( gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE )
// select default
# if defined( gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME )
# define gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME
# else
# define gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE
# endif
#endif
// C++ language version detection (C++23 is speculative):
// Note: VC14.0/1900 (VS2015) lacks too much from C++14.
#ifndef gsl_CPLUSPLUS
# if defined(_MSVC_LANG ) && !defined(__clang__)
# define gsl_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG )
# else
# define gsl_CPLUSPLUS __cplusplus
# endif
#endif
// C++ standard library version:
#ifndef gsl_CPLUSPLUS_STDLIB
# define gsl_CPLUSPLUS_STDLIB gsl_CPLUSPLUS
#endif
#define gsl_CPP98_OR_GREATER ( gsl_CPLUSPLUS >= 199711L )
#define gsl_CPP11_OR_GREATER ( gsl_CPLUSPLUS >= 201103L )
#define gsl_CPP14_OR_GREATER ( gsl_CPLUSPLUS >= 201402L )
#define gsl_CPP17_OR_GREATER ( gsl_CPLUSPLUS >= 201703L )
#define gsl_CPP20_OR_GREATER ( gsl_CPLUSPLUS >= 202002L )
#define gsl_CPP23_OR_GREATER ( gsl_CPLUSPLUS > 202002L ) // tentative
// C++ language version (represent 98 as 3):
#define gsl_CPLUSPLUS_V ( gsl_CPLUSPLUS / 100 - (gsl_CPLUSPLUS > 200000 ? 2000 : 1994) )
// half-open range [lo..hi):
#define gsl_BETWEEN( v, lo, hi ) ( (lo) <= (v) && (v) < (hi) )
// Compiler versions:
// MSVC++ 6.0 _MSC_VER == 1200 gsl_COMPILER_MSVC_VERSION == 60 (Visual Studio 6.0)
// MSVC++ 7.0 _MSC_VER == 1300 gsl_COMPILER_MSVC_VERSION == 70 (Visual Studio .NET 2002)
// MSVC++ 7.1 _MSC_VER == 1310 gsl_COMPILER_MSVC_VERSION == 71 (Visual Studio .NET 2003)
// MSVC++ 8.0 _MSC_VER == 1400 gsl_COMPILER_MSVC_VERSION == 80 (Visual Studio 2005)
// MSVC++ 9.0 _MSC_VER == 1500 gsl_COMPILER_MSVC_VERSION == 90 (Visual Studio 2008)
// MSVC++ 10.0 _MSC_VER == 1600 gsl_COMPILER_MSVC_VERSION == 100 (Visual Studio 2010)
// MSVC++ 11.0 _MSC_VER == 1700 gsl_COMPILER_MSVC_VERSION == 110 (Visual Studio 2012)
// MSVC++ 12.0 _MSC_VER == 1800 gsl_COMPILER_MSVC_VERSION == 120 (Visual Studio 2013)
// MSVC++ 14.0 _MSC_VER == 1900 gsl_COMPILER_MSVC_VERSION == 140 (Visual Studio 2015)
// MSVC++ 14.1 _MSC_VER >= 1910 gsl_COMPILER_MSVC_VERSION == 141 (Visual Studio 2017)
// MSVC++ 14.2 _MSC_VER >= 1920 gsl_COMPILER_MSVC_VERSION == 142 (Visual Studio 2019)
// MSVC++ 14.3 _MSC_VER >= 1930 gsl_COMPILER_MSVC_VERSION == 143 (Visual Studio 2022)
#if defined( _MSC_VER ) && ! defined( __clang__ )
# define gsl_COMPILER_MSVC_VER (_MSC_VER )
# define gsl_COMPILER_MSVC_VERSION (_MSC_VER / 10 - 10 * ( 5 + (_MSC_VER < 1900 ) ) )
# define gsl_COMPILER_MSVC_VERSION_FULL (_MSC_VER - 100 * ( 5 + (_MSC_VER < 1900 ) ) )
#else
# define gsl_COMPILER_MSVC_VER 0
# define gsl_COMPILER_MSVC_VERSION 0
# define gsl_COMPILER_MSVC_VERSION_FULL 0
#endif
#define gsl_COMPILER_VERSION( major, minor, patch ) ( 10 * ( 10 * (major) + (minor) ) + (patch) )
// AppleClang 7.0.0 __apple_build_version__ == 7000172 gsl_COMPILER_APPLECLANG_VERSION == 700 (Xcode 7.0, 7.0.1) (LLVM 3.7.0)
// AppleClang 7.0.0 __apple_build_version__ == 7000176 gsl_COMPILER_APPLECLANG_VERSION == 700 (Xcode 7.1) (LLVM 3.7.0)
// AppleClang 7.0.2 __apple_build_version__ == 7000181 gsl_COMPILER_APPLECLANG_VERSION == 702 (Xcode 7.2, 7.2.1) (LLVM 3.7.0)
// AppleClang 7.3.0 __apple_build_version__ == 7030029 gsl_COMPILER_APPLECLANG_VERSION == 730 (Xcode 7.3) (LLVM 3.8.0)
// AppleClang 7.3.0 __apple_build_version__ == 7030031 gsl_COMPILER_APPLECLANG_VERSION == 730 (Xcode 7.3.1) (LLVM 3.8.0)
// AppleClang 8.0.0 __apple_build_version__ == 8000038 gsl_COMPILER_APPLECLANG_VERSION == 800 (Xcode 8.0) (LLVM 3.9.0)
// AppleClang 8.0.0 __apple_build_version__ == 8000042 gsl_COMPILER_APPLECLANG_VERSION == 800 (Xcode 8.1, 8.2, 8.2.1) (LLVM 3.9.0)
// AppleClang 8.1.0 __apple_build_version__ == 8020038 gsl_COMPILER_APPLECLANG_VERSION == 810 (Xcode 8.3) (LLVM 3.9.0)
// AppleClang 8.1.0 __apple_build_version__ == 8020041 gsl_COMPILER_APPLECLANG_VERSION == 810 (Xcode 8.3.1) (LLVM 3.9.0)
// AppleClang 8.1.0 __apple_build_version__ == 8020042 gsl_COMPILER_APPLECLANG_VERSION == 810 (Xcode 8.3.2, 8.3.3) (LLVM 3.9.0)
// AppleClang 9.0.0 __apple_build_version__ == 9000037 gsl_COMPILER_APPLECLANG_VERSION == 900 (Xcode 9.0) (LLVM 4.0.0)
// AppleClang 9.0.0 __apple_build_version__ == 9000038 gsl_COMPILER_APPLECLANG_VERSION == 900 (Xcode 9.1) (LLVM 4.0.0)
// AppleClang 9.0.0 __apple_build_version__ == 9000039 gsl_COMPILER_APPLECLANG_VERSION == 900 (Xcode 9.2) (LLVM 4.0.0)
// AppleClang 9.1.0 __apple_build_version__ == 9020039 gsl_COMPILER_APPLECLANG_VERSION == 910 (Xcode 9.3, 9.3.1) (LLVM 5.0.2)
// AppleClang 9.1.0 __apple_build_version__ == 9020039 gsl_COMPILER_APPLECLANG_VERSION == 910 (Xcode 9.4, 9.4.1) (LLVM 5.0.2)
// AppleClang 10.0.0 __apple_build_version__ == 10001145 gsl_COMPILER_APPLECLANG_VERSION == 1000 (Xcode 10.0, 10.1) (LLVM 6.0.1)
// AppleClang 10.0.1 __apple_build_version__ == 10010046 gsl_COMPILER_APPLECLANG_VERSION == 1001 (Xcode 10.2, 10.2.1, 10.3) (LLVM 7.0.0)
// AppleClang 11.0.0 __apple_build_version__ == 11000033 gsl_COMPILER_APPLECLANG_VERSION == 1100 (Xcode 11.1, 11.2, 11.3, 11.3.1) (LLVM 8.0.0)
// AppleClang 11.0.3 __apple_build_version__ == 11030032 gsl_COMPILER_APPLECLANG_VERSION == 1103 (Xcode 11.4, 11.4.1, 11.5, 11.6) (LLVM 9.0.0)
// AppleClang 12.0.0 __apple_build_version__ == 12000032 gsl_COMPILER_APPLECLANG_VERSION == 1200 (Xcode 12.0–12.4) (LLVM 10.0.0)
// AppleClang 12.0.5 __apple_build_version__ == 12050022 gsl_COMPILER_APPLECLANG_VERSION == 1205 (Xcode 12.5) (LLVM 11.1.0)
// AppleClang 13.0.0 __apple_build_version__ == 13000029 gsl_COMPILER_APPLECLANG_VERSION == 1300 (Xcode 13.0–13.2.1) (LLVM 12.0.0)
// AppleClang 13.1.6 __apple_build_version__ == 13160021 gsl_COMPILER_APPLECLANG_VERSION == 1316 (Xcode 13.3–13.4.1) (LLVM 13.0.0)
// AppleClang 14.0.0 __apple_build_version__ == 14000029 gsl_COMPILER_APPLECLANG_VERSION == 1400 (Xcode 14.0–14.2) (LLVM 14.0.0)
// AppleClang 14.0.3 __apple_build_version__ == 14030022 gsl_COMPILER_APPLECLANG_VERSION == 1403 (Xcode 14.3) (LLVM 15.0.0)
#if defined( __apple_build_version__ )
# define gsl_COMPILER_APPLECLANG_VERSION gsl_COMPILER_VERSION( __clang_major__, __clang_minor__, __clang_patchlevel__ )
# define gsl_COMPILER_CLANG_VERSION 0
#elif defined( __clang__ )
# define gsl_COMPILER_APPLECLANG_VERSION 0
# define gsl_COMPILER_CLANG_VERSION gsl_COMPILER_VERSION( __clang_major__, __clang_minor__, __clang_patchlevel__ )
#else
# define gsl_COMPILER_APPLECLANG_VERSION 0
# define gsl_COMPILER_CLANG_VERSION 0
#endif
#if defined( __GNUC__ ) && ! defined( __clang__ ) && ! defined( __NVCOMPILER )
# define gsl_COMPILER_GNUC_VERSION gsl_COMPILER_VERSION( __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ )
#else
# define gsl_COMPILER_GNUC_VERSION 0
#endif
#if defined( __NVCC__ )
# define gsl_COMPILER_NVCC_VERSION ( __CUDACC_VER_MAJOR__ * 10 + __CUDACC_VER_MINOR__ )
#else
# define gsl_COMPILER_NVCC_VERSION 0
#endif
// NVHPC 21.2 gsl_COMPILER_NVHPC_VERSION == 2120
#if defined( __NVCOMPILER )
# define gsl_COMPILER_NVHPC_VERSION gsl_COMPILER_VERSION( __NVCOMPILER_MAJOR__, __NVCOMPILER_MINOR__, __NVCOMPILER_PATCHLEVEL__ )
#else
# define gsl_COMPILER_NVHPC_VERSION 0
#endif
#if defined( __ARMCC_VERSION )
# define gsl_COMPILER_ARMCC_VERSION ( __ARMCC_VERSION / 10000 )
# define gsl_COMPILER_ARMCC_VERSION_FULL __ARMCC_VERSION
#else
# define gsl_COMPILER_ARMCC_VERSION 0
# define gsl_COMPILER_ARMCC_VERSION_FULL 0
#endif
// Compiler non-strict aliasing:
#if defined(__clang__) || defined(__GNUC__)
# define gsl_may_alias __attribute__((__may_alias__))
#else
# define gsl_may_alias
#endif
// Presence of gsl, language and library features:
#define gsl_IN_STD( v ) ( ((v) == 98 ? 3 : (v)) >= gsl_CPLUSPLUS_V )
#define gsl_DEPRECATE_TO_LEVEL( level ) ( level <= gsl_CONFIG_DEPRECATE_TO_LEVEL )
#define gsl_FEATURE_TO_STD( feature ) gsl_IN_STD( gsl_FEATURE( feature##_TO_STD ) )
#define gsl_FEATURE( feature ) gsl_EVALF_( gsl_FEATURE_##feature##_ )
#define gsl_CONFIG( feature ) gsl_EVALF_( gsl_CONFIG_##feature##_ )
#define gsl_HAVE( feature ) gsl_EVALF_( gsl_HAVE_##feature##_ )
// Presence of wide character support:
#if defined(__DJGPP__) || (defined(_LIBCPP_VERSION) && defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS))
# define gsl_HAVE_WCHAR 0
#else
# define gsl_HAVE_WCHAR 1
#endif
#define gsl_HAVE_WCHAR_() gsl_HAVE_WCHAR
// Compiling device code:
#if defined( __CUDACC__ ) && defined( __CUDA_ARCH__ )
# define gsl_DEVICE_CODE 1
#else
# define gsl_DEVICE_CODE 0
#endif
// Presence of language & library features:
#if gsl_COMPILER_CLANG_VERSION || gsl_COMPILER_APPLECLANG_VERSION
# ifdef __OBJC__
// There are a bunch of inconsistencies about __EXCEPTIONS and __has_feature(cxx_exceptions) in Clang 3.4/3.5/3.6.
// We're interested in C++ exceptions, which can be checked by __has_feature(cxx_exceptions) in 3.5+.
// In pre-3.5, __has_feature(cxx_exceptions) can be true if ObjC exceptions are enabled, but C++ exceptions are disabled.
// The recommended way to check is `__EXCEPTIONS && __has_feature(cxx_exceptions)`.
// See https://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-exceptions-macro
// Note: this is only relevant in Objective-C++, thus the ifdef.
# if __EXCEPTIONS && __has_feature(cxx_exceptions)
# define gsl_HAVE_EXCEPTIONS 1
# else
# define gsl_HAVE_EXCEPTIONS 0
# endif // __EXCEPTIONS && __has_feature(cxx_exceptions)
# else
// clang-cl doesn't define __EXCEPTIONS for MSVC compatibility (see https://reviews.llvm.org/D4065).
// Neither does Clang in MS-compatiblity mode.
// Let's hope no one tries to build Objective-C++ code using MS-compatibility mode or clang-cl.
# if __has_feature(cxx_exceptions)
# define gsl_HAVE_EXCEPTIONS 1
# else
# define gsl_HAVE_EXCEPTIONS 0
# endif
# endif
#elif defined( __GNUC__ )
# if __GNUC__ < 5
# ifdef __EXCEPTIONS
# define gsl_HAVE_EXCEPTIONS 1
# else
# define gsl_HAVE_EXCEPTIONS 0
# endif // __EXCEPTIONS
# else
# ifdef __cpp_exceptions
# define gsl_HAVE_EXCEPTIONS 1
# else
# define gsl_HAVE_EXCEPTIONS 0
# endif // __cpp_exceptions
# endif // __GNUC__ < 5
#elif gsl_COMPILER_MSVC_VERSION
# ifdef _CPPUNWIND
# define gsl_HAVE_EXCEPTIONS 1
# else
# define gsl_HAVE_EXCEPTIONS 0
# endif // _CPPUNWIND
#else
// For all other compilers, assume exceptions are always enabled.
# define gsl_HAVE_EXCEPTIONS 1
#endif
#define gsl_HAVE_EXCEPTIONS_() gsl_HAVE_EXCEPTIONS
#if defined( gsl_CONFIG_CONTRACT_VIOLATION_THROWS ) && ! gsl_HAVE_EXCEPTIONS
# error Cannot use gsl_CONFIG_CONTRACT_VIOLATION_THROWS if exceptions are disabled.
#endif // defined( gsl_CONFIG_CONTRACT_VIOLATION_THROWS ) && !gsl_HAVE( EXCEPTIONS )
#ifdef _HAS_CPP0X
# define gsl_HAS_CPP0X _HAS_CPP0X
#else
# define gsl_HAS_CPP0X 0
#endif
#define gsl_CPP11_100 (gsl_CPP11_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1600)
#define gsl_CPP11_110 (gsl_CPP11_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1700)
#define gsl_CPP11_120 (gsl_CPP11_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1800)
#define gsl_CPP11_140 (gsl_CPP11_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1900)
#define gsl_CPP14_000 (gsl_CPP14_OR_GREATER)
#define gsl_CPP14_120 (gsl_CPP14_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1800)
#define gsl_CPP14_140 (gsl_CPP14_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1900)
#define gsl_CPP17_000 (gsl_CPP17_OR_GREATER)
#define gsl_CPP17_140 (gsl_CPP17_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1900)
#define gsl_CPP11_140_CPP0X_90 (gsl_CPP11_140 || (gsl_COMPILER_MSVC_VER >= 1500 && gsl_HAS_CPP0X))
#define gsl_CPP11_140_CPP0X_100 (gsl_CPP11_140 || (gsl_COMPILER_MSVC_VER >= 1600 && gsl_HAS_CPP0X))
// Presence of C++11 language features:
#define gsl_HAVE_C99_PREPROCESSOR gsl_CPP11_140
#define gsl_HAVE_AUTO gsl_CPP11_100
#define gsl_HAVE_RVALUE_REFERENCE gsl_CPP11_100
#define gsl_HAVE_FUNCTION_REF_QUALIFIER ( gsl_CPP11_140 && ! gsl_BETWEEN( gsl_COMPILER_GNUC_VERSION, 1, 481 ) )
#define gsl_HAVE_ENUM_CLASS gsl_CPP11_110
#define gsl_HAVE_ALIAS_TEMPLATE gsl_CPP11_120
#define gsl_HAVE_DEFAULT_FUNCTION_TEMPLATE_ARG gsl_CPP11_120
#define gsl_HAVE_EXPLICIT gsl_CPP11_120
#define gsl_HAVE_VARIADIC_TEMPLATE gsl_CPP11_120
#define gsl_HAVE_IS_DELETE gsl_CPP11_120
#define gsl_HAVE_CONSTEXPR_11 gsl_CPP11_140
#define gsl_HAVE_IS_DEFAULT gsl_CPP11_140
#define gsl_HAVE_NOEXCEPT gsl_CPP11_140
#define gsl_HAVE_NORETURN ( gsl_CPP11_140 && ! gsl_BETWEEN( gsl_COMPILER_GNUC_VERSION, 1, 480 ) )
#define gsl_HAVE_EXPRESSION_SFINAE gsl_CPP11_140
#define gsl_HAVE_OVERRIDE_FINAL gsl_CPP11_110
#define gsl_HAVE_C99_PREPROCESSOR_() gsl_HAVE_C99_PREPROCESSOR
#define gsl_HAVE_AUTO_() gsl_HAVE_AUTO
#define gsl_HAVE_RVALUE_REFERENCE_() gsl_HAVE_RVALUE_REFERENCE
#define gsl_HAVE_FUNCTION_REF_QUALIFIER_() gsl_HAVE_FUNCTION_REF_QUALIFIER
#define gsl_HAVE_ENUM_CLASS_() gsl_HAVE_ENUM_CLASS
#define gsl_HAVE_ALIAS_TEMPLATE_() gsl_HAVE_ALIAS_TEMPLATE
#define gsl_HAVE_DEFAULT_FUNCTION_TEMPLATE_ARG_() gsl_HAVE_DEFAULT_FUNCTION_TEMPLATE_ARG
#define gsl_HAVE_EXPLICIT_() gsl_HAVE_EXPLICIT
#define gsl_HAVE_VARIADIC_TEMPLATE_() gsl_HAVE_VARIADIC_TEMPLATE
#define gsl_HAVE_IS_DELETE_() gsl_HAVE_IS_DELETE
#define gsl_HAVE_CONSTEXPR_11_() gsl_HAVE_CONSTEXPR_11
#define gsl_HAVE_IS_DEFAULT_() gsl_HAVE_IS_DEFAULT
#define gsl_HAVE_NOEXCEPT_() gsl_HAVE_NOEXCEPT
#define gsl_HAVE_NORETURN_() gsl_HAVE_NORETURN
#define gsl_HAVE_EXPRESSION_SFINAE_() gsl_HAVE_EXPRESSION_SFINAE
#define gsl_HAVE_OVERRIDE_FINAL_() gsl_HAVE_OVERRIDE_FINAL
// Presence of C++14 language features:
#define gsl_HAVE_CONSTEXPR_14 ( gsl_CPP14_000 && ! gsl_BETWEEN( gsl_COMPILER_GNUC_VERSION, 1, 600 ) )
#define gsl_HAVE_DECLTYPE_AUTO gsl_CPP14_140
#define gsl_HAVE_DEPRECATED ( gsl_CPP14_140 && ! gsl_BETWEEN( gsl_COMPILER_MSVC_VERSION, 1, 142 ) )
#define gsl_HAVE_CONSTEXPR_14_() gsl_HAVE_CONSTEXPR_14
#define gsl_HAVE_DECLTYPE_AUTO_() gsl_HAVE_DECLTYPE_AUTO
#define gsl_HAVE_DEPRECATED_() gsl_HAVE_DEPRECATED
// Presence of C++17 language features:
// MSVC: template parameter deduction guides since Visual Studio 2017 v15.7
#define gsl_HAVE_ENUM_CLASS_CONSTRUCTION_FROM_UNDERLYING_TYPE gsl_CPP17_000
#define gsl_HAVE_DEDUCTION_GUIDES ( gsl_CPP17_000 && ! gsl_BETWEEN( gsl_COMPILER_MSVC_VERSION_FULL, 1, 1414 ) )
#define gsl_HAVE_NODISCARD gsl_CPP17_000
#define gsl_HAVE_CONSTEXPR_17 gsl_CPP17_OR_GREATER
#define gsl_HAVE_ENUM_CLASS_CONSTRUCTION_FROM_UNDERLYING_TYPE_() gsl_HAVE_ENUM_CLASS_CONSTRUCTION_FROM_UNDERLYING_TYPE
#define gsl_HAVE_DEDUCTION_GUIDES_() gsl_HAVE_DEDUCTION_GUIDES
#define gsl_HAVE_NODISCARD_() gsl_HAVE_NODISCARD
#define gsl_HAVE_MAYBE_UNUSED_() gsl_CPP17_OR_GREATER
#define gsl_HAVE_CONSTEXPR_17_() gsl_HAVE_CONSTEXPR_17
// Presence of C++20 language features:
#define gsl_HAVE_CONSTEXPR_20 gsl_CPP20_OR_GREATER
#define gsl_HAVE_CONSTEXPR_20_() gsl_HAVE_CONSTEXPR_20
// Presence of C++23 language features:
#define gsl_HAVE_CONSTEXPR_23 gsl_CPP23_OR_GREATER
#define gsl_HAVE_CONSTEXPR_23_() gsl_HAVE_CONSTEXPR_23
// Presence of C++ library features:
#if gsl_BETWEEN( gsl_COMPILER_ARMCC_VERSION, 1, 600 )
// Some versions of the ARM compiler apparently ship without a C++11 standard library despite having some C++11 support.
# define gsl_STDLIB_CPP98_OR_GREATER gsl_CPP98_OR_GREATER
# define gsl_STDLIB_CPP11_OR_GREATER 0
# define gsl_STDLIB_CPP14_OR_GREATER 0
# define gsl_STDLIB_CPP17_OR_GREATER 0
# define gsl_STDLIB_CPP20_OR_GREATER 0
# define gsl_STDLIB_CPP23_OR_GREATER 0
#else
# define gsl_STDLIB_CPP98_OR_GREATER gsl_CPP98_OR_GREATER
# define gsl_STDLIB_CPP11_OR_GREATER gsl_CPP11_OR_GREATER
# define gsl_STDLIB_CPP14_OR_GREATER gsl_CPP14_OR_GREATER
# define gsl_STDLIB_CPP17_OR_GREATER gsl_CPP17_OR_GREATER
# define gsl_STDLIB_CPP20_OR_GREATER gsl_CPP20_OR_GREATER
# define gsl_STDLIB_CPP23_OR_GREATER gsl_CPP23_OR_GREATER
#endif
#define gsl_STDLIB_CPP11_100 (gsl_STDLIB_CPP11_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1600)
#define gsl_STDLIB_CPP11_110 (gsl_STDLIB_CPP11_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1700)
#define gsl_STDLIB_CPP11_120 (gsl_STDLIB_CPP11_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1800)
#define gsl_STDLIB_CPP11_140 (gsl_STDLIB_CPP11_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1900)
#define gsl_STDLIB_CPP14_000 (gsl_STDLIB_CPP14_OR_GREATER)
#define gsl_STDLIB_CPP14_120 (gsl_STDLIB_CPP14_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1800)
#define gsl_STDLIB_CPP14_140 (gsl_STDLIB_CPP14_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1900)
#define gsl_STDLIB_CPP17_000 (gsl_STDLIB_CPP17_OR_GREATER)
#define gsl_STDLIB_CPP17_140 (gsl_STDLIB_CPP17_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1900)
#define gsl_STDLIB_CPP11_140_CPP0X_90 (gsl_STDLIB_CPP11_140 || (gsl_COMPILER_MSVC_VER >= 1500 && gsl_HAS_CPP0X))
#define gsl_STDLIB_CPP11_140_CPP0X_100 (gsl_STDLIB_CPP11_140 || (gsl_COMPILER_MSVC_VER >= 1600 && gsl_HAS_CPP0X))
#define gsl_HAVE_ADDRESSOF gsl_STDLIB_CPP17_000
#define gsl_HAVE_ARRAY gsl_STDLIB_CPP11_110
#define gsl_HAVE_TYPE_TRAITS gsl_STDLIB_CPP11_110
#define gsl_HAVE_TR1_TYPE_TRAITS gsl_STDLIB_CPP11_110
#define gsl_HAVE_CONTAINER_DATA_METHOD gsl_STDLIB_CPP11_140_CPP0X_90
#define gsl_HAVE_STD_DATA gsl_STDLIB_CPP17_000
#ifdef __cpp_lib_ssize
# define gsl_HAVE_STD_SSIZE 1
#else
# define gsl_HAVE_STD_SSIZE ( gsl_COMPILER_GNUC_VERSION >= 1000 && __cplusplus > 201703L )
#endif
#define gsl_HAVE_HASH gsl_STDLIB_CPP11_120
#define gsl_HAVE_SIZED_TYPES gsl_STDLIB_CPP11_140
#define gsl_HAVE_MAKE_SHARED gsl_STDLIB_CPP11_140_CPP0X_100
#define gsl_HAVE_SHARED_PTR gsl_STDLIB_CPP11_140_CPP0X_100
#define gsl_HAVE_UNIQUE_PTR gsl_STDLIB_CPP11_140_CPP0X_100
#define gsl_HAVE_MAKE_UNIQUE gsl_STDLIB_CPP14_120
#define gsl_HAVE_MOVE_FORWARD gsl_STDLIB_CPP11_100
#define gsl_HAVE_NULLPTR gsl_STDLIB_CPP11_100
#define gsl_HAVE_UNCAUGHT_EXCEPTIONS gsl_STDLIB_CPP17_140
#define gsl_HAVE_ADD_CONST gsl_HAVE_TYPE_TRAITS
#define gsl_HAVE_INITIALIZER_LIST gsl_STDLIB_CPP11_120
#define gsl_HAVE_INTEGRAL_CONSTANT gsl_HAVE_TYPE_TRAITS
#define gsl_HAVE_REMOVE_CONST gsl_HAVE_TYPE_TRAITS
#define gsl_HAVE_REMOVE_REFERENCE gsl_HAVE_TYPE_TRAITS
#define gsl_HAVE_REMOVE_CVREF gsl_STDLIB_CPP20_OR_GREATER
#define gsl_HAVE_TR1_ADD_CONST gsl_HAVE_TR1_TYPE_TRAITS
#define gsl_HAVE_TR1_INTEGRAL_CONSTANT gsl_HAVE_TR1_TYPE_TRAITS
#define gsl_HAVE_TR1_REMOVE_CONST gsl_HAVE_TR1_TYPE_TRAITS
#define gsl_HAVE_TR1_REMOVE_REFERENCE gsl_HAVE_TR1_TYPE_TRAITS
#define gsl_HAVE_ADDRESSOF_() gsl_HAVE_ADDRESSOF
#define gsl_HAVE_ARRAY_() gsl_HAVE_ARRAY
#define gsl_HAVE_TYPE_TRAITS_() gsl_HAVE_TYPE_TRAITS
#define gsl_HAVE_TR1_TYPE_TRAITS_() gsl_HAVE_TR1_TYPE_TRAITS
#define gsl_HAVE_CONTAINER_DATA_METHOD_() gsl_HAVE_CONTAINER_DATA_METHOD
#define gsl_HAVE_HASH_() gsl_HAVE_HASH
#define gsl_HAVE_STD_DATA_() gsl_HAVE_STD_DATA
#define gsl_HAVE_STD_SSIZE_() gsl_HAVE_STD_SSIZE
#define gsl_HAVE_SIZED_TYPES_() gsl_HAVE_SIZED_TYPES
#define gsl_HAVE_MAKE_SHARED_() gsl_HAVE_MAKE_SHARED
#define gsl_HAVE_MOVE_FORWARD_() gsl_HAVE_MOVE_FORWARD
#define gsl_HAVE_NULLPTR_() gsl_HAVE_NULLPTR // It's a language feature but needs library support, so we list it as a library feature.
#define gsl_HAVE_SHARED_PTR_() gsl_HAVE_SHARED_PTR
#define gsl_HAVE_UNIQUE_PTR_() gsl_HAVE_UNIQUE_PTR
#define gsl_HAVE_MAKE_UNIQUE_() gsl_HAVE_MAKE_UNIQUE
#define gsl_HAVE_UNCAUGHT_EXCEPTIONS_() gsl_HAVE_UNCAUGHT_EXCEPTIONS
#define gsl_HAVE_ADD_CONST_() gsl_HAVE_ADD_CONST
#define gsl_HAVE_INITIALIZER_LIST_() gsl_HAVE_INITIALIZER_LIST // It's a language feature but needs library support, so we list it as a library feature.
#define gsl_HAVE_INTEGRAL_CONSTANT_() gsl_HAVE_INTEGRAL_CONSTANT
#define gsl_HAVE_REMOVE_CONST_() gsl_HAVE_REMOVE_CONST
#define gsl_HAVE_REMOVE_REFERENCE_() gsl_HAVE_REMOVE_REFERENCE
#define gsl_HAVE_REMOVE_CVREF_() gsl_HAVE_REMOVE_CVREF
#define gsl_HAVE_TR1_ADD_CONST_() gsl_HAVE_TR1_ADD_CONST
#define gsl_HAVE_TR1_INTEGRAL_CONSTANT_() gsl_HAVE_TR1_INTEGRAL_CONSTANT
#define gsl_HAVE_TR1_REMOVE_CONST_() gsl_HAVE_TR1_REMOVE_CONST
#define gsl_HAVE_TR1_REMOVE_REFERENCE_() gsl_HAVE_TR1_REMOVE_REFERENCE
// C++ feature usage:
#if gsl_HAVE( ADDRESSOF )
# define gsl_ADDRESSOF(x) std::addressof(x)
#else
# define gsl_ADDRESSOF(x) (&x)
#endif
#if gsl_HAVE( CONSTEXPR_11 )
# define gsl_constexpr constexpr
#else
# define gsl_constexpr /*constexpr*/
#endif
#if gsl_HAVE( CONSTEXPR_14 )
# define gsl_constexpr14 constexpr
#else
# define gsl_constexpr14 /*constexpr*/
#endif
#if gsl_HAVE( CONSTEXPR_17 )
# define gsl_constexpr17 constexpr
#else
# define gsl_constexpr17 /*constexpr*/
#endif
#if gsl_HAVE( CONSTEXPR_20 )
# define gsl_constexpr20 constexpr
#else
# define gsl_constexpr20 /*constexpr*/
#endif
#if gsl_HAVE( CONSTEXPR_23 )
# define gsl_constexpr23 constexpr
#else
# define gsl_constexpr23 /*constexpr*/
#endif
#if gsl_HAVE( EXPLICIT )
# define gsl_explicit explicit
#else
# define gsl_explicit /*explicit*/
#endif
#if gsl_FEATURE( IMPLICIT_MACRO )
# define implicit /*implicit*/
#endif
#if gsl_HAVE( IS_DELETE )
# define gsl_is_delete = delete
#else
# define gsl_is_delete
#endif
#if gsl_HAVE( IS_DELETE )
# define gsl_is_delete_access public
#else
# define gsl_is_delete_access private
#endif
#if gsl_HAVE( NOEXCEPT )
# define gsl_noexcept noexcept
# define gsl_noexcept_if( expr ) noexcept( expr )
#else
# define gsl_noexcept throw()
# define gsl_noexcept_if( expr ) /*noexcept( expr )*/
#endif
#if defined( gsl_TESTING_ )
# define gsl_noexcept_not_testing
#else
# define gsl_noexcept_not_testing gsl_noexcept
#endif
#if gsl_HAVE( NULLPTR )
# define gsl_nullptr nullptr
#else
# define gsl_nullptr NULL
#endif
#if gsl_HAVE( NODISCARD )
# define gsl_NODISCARD [[nodiscard]]
#else
# define gsl_NODISCARD
#endif
#if gsl_HAVE( NORETURN )
# define gsl_NORETURN [[noreturn]]
#elif defined(_MSC_VER)
# define gsl_NORETURN __declspec(noreturn)
#elif defined( __GNUC__ ) || gsl_COMPILER_ARMCC_VERSION
# define gsl_NORETURN __attribute__((noreturn))
#else
# define gsl_NORETURN
#endif
#if gsl_HAVE( MAYBE_UNUSED )
# define gsl_MAYBE_UNUSED [[maybe_unused]]
# if gsl_COMPILER_GNUC_VERSION
// GCC currently ignores the [[maybe_unused]] attribute on data members and warns accordingly (cf. https://stackoverflow.com/a/65633590).
# define gsl_MAYBE_UNUSED_MEMBER
# else // ! gsl_COMPILER_GNUC_VERSION
# define gsl_MAYBE_UNUSED_MEMBER [[maybe_unused]]
# endif // gsl_COMPILER_GNUC_VERSION
#else
# define gsl_MAYBE_UNUSED
# define gsl_MAYBE_UNUSED_MEMBER
#endif