NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
span-lite.hpp
Go to the documentation of this file.
1 //
2 // span for C++98 and later.
3 // Based on http://wg21.link/p0122r7
4 // For more information see https://github.com/martinmoene/span-lite
5 //
6 // Copyright 2018-2021 Martin Moene
7 //
8 // Distributed under the Boost Software License, Version 1.0.
9 // (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 
11 #ifndef NONSTD_SPAN_HPP_INCLUDED
12 #define NONSTD_SPAN_HPP_INCLUDED
13 
14 #define span_lite_MAJOR 0
15 #define span_lite_MINOR 10
16 #define span_lite_PATCH 3
17 
18 #define span_lite_VERSION span_STRINGIFY(span_lite_MAJOR) "." span_STRINGIFY(span_lite_MINOR) "." span_STRINGIFY(span_lite_PATCH)
19 
20 #define span_STRINGIFY( x ) span_STRINGIFY_( x )
21 #define span_STRINGIFY_( x ) #x
22 
23 // span configuration:
24 
25 #define span_SPAN_DEFAULT 0
26 #define span_SPAN_NONSTD 1
27 #define span_SPAN_STD 2
28 
29 // tweak header support:
30 
31 #ifdef __has_include
32 # if __has_include(<nonstd/span.tweak.hpp>)
33 # include <nonstd/span.tweak.hpp>
34 # endif
35 #define span_HAVE_TWEAK_HEADER 1
36 #else
37 #define span_HAVE_TWEAK_HEADER 0
38 //# pragma message("span.hpp: Note: Tweak header not supported.")
39 #endif
40 
41 // span selection and configuration:
42 
43 #define span_HAVE( feature ) ( span_HAVE_##feature )
44 
45 #ifndef span_CONFIG_SELECT_SPAN
46 # define span_CONFIG_SELECT_SPAN ( span_HAVE_STD_SPAN ? span_SPAN_STD : span_SPAN_NONSTD )
47 #endif
48 
49 #ifndef span_CONFIG_EXTENT_TYPE
50 # define span_CONFIG_EXTENT_TYPE std::size_t
51 #endif
52 
53 #ifndef span_CONFIG_SIZE_TYPE
54 # define span_CONFIG_SIZE_TYPE std::size_t
55 #endif
56 
57 #ifdef span_CONFIG_INDEX_TYPE
58 # error `span_CONFIG_INDEX_TYPE` is deprecated since v0.7.0; it is replaced by `span_CONFIG_SIZE_TYPE`.
59 #endif
60 
61 // span configuration (features):
62 
63 #ifndef span_FEATURE_WITH_INITIALIZER_LIST_P2447
64 # define span_FEATURE_WITH_INITIALIZER_LIST_P2447 0
65 #endif
66 
67 #ifndef span_FEATURE_WITH_CONTAINER
68 #ifdef span_FEATURE_WITH_CONTAINER_TO_STD
69 # define span_FEATURE_WITH_CONTAINER span_IN_STD( span_FEATURE_WITH_CONTAINER_TO_STD )
70 #else
71 # define span_FEATURE_WITH_CONTAINER 0
72 # define span_FEATURE_WITH_CONTAINER_TO_STD 0
73 #endif
74 #endif
75 
76 #ifndef span_FEATURE_CONSTRUCTION_FROM_STDARRAY_ELEMENT_TYPE
77 # define span_FEATURE_CONSTRUCTION_FROM_STDARRAY_ELEMENT_TYPE 0
78 #endif
79 
80 #ifndef span_FEATURE_MEMBER_AT
81 # define span_FEATURE_MEMBER_AT 0
82 #endif
83 
84 #ifndef span_FEATURE_MEMBER_BACK_FRONT
85 # define span_FEATURE_MEMBER_BACK_FRONT 1
86 #endif
87 
88 #ifndef span_FEATURE_MEMBER_CALL_OPERATOR
89 # define span_FEATURE_MEMBER_CALL_OPERATOR 0
90 #endif
91 
92 #ifndef span_FEATURE_MEMBER_SWAP
93 # define span_FEATURE_MEMBER_SWAP 0
94 #endif
95 
96 #ifndef span_FEATURE_NON_MEMBER_FIRST_LAST_SUB
97 # define span_FEATURE_NON_MEMBER_FIRST_LAST_SUB 0
98 #elif span_FEATURE_NON_MEMBER_FIRST_LAST_SUB
99 # define span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_SPAN 1
100 # define span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_CONTAINER 1
101 #endif
102 
103 #ifndef span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_SPAN
104 # define span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_SPAN 0
105 #endif
106 
107 #ifndef span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_CONTAINER
108 # define span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_CONTAINER 0
109 #endif
110 
111 #ifndef span_FEATURE_COMPARISON
112 # define span_FEATURE_COMPARISON 0 // Note: C++20 does not provide comparison
113 #endif
114 
115 #ifndef span_FEATURE_SAME
116 # define span_FEATURE_SAME 0
117 #endif
118 
119 #if span_FEATURE_SAME && !span_FEATURE_COMPARISON
120 # error `span_FEATURE_SAME` requires `span_FEATURE_COMPARISON`
121 #endif
122 
123 #ifndef span_FEATURE_MAKE_SPAN
124 #ifdef span_FEATURE_MAKE_SPAN_TO_STD
125 # define span_FEATURE_MAKE_SPAN span_IN_STD( span_FEATURE_MAKE_SPAN_TO_STD )
126 #else
127 # define span_FEATURE_MAKE_SPAN 0
128 # define span_FEATURE_MAKE_SPAN_TO_STD 0
129 #endif
130 #endif
131 
132 #ifndef span_FEATURE_BYTE_SPAN
133 # define span_FEATURE_BYTE_SPAN 0
134 #endif
135 
136 // Control presence of exception handling (try and auto discover):
137 
138 #ifndef span_CONFIG_NO_EXCEPTIONS
139 # if defined(_MSC_VER)
140 # include <cstddef> // for _HAS_EXCEPTIONS
141 # endif
142 # if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || (_HAS_EXCEPTIONS)
143 # define span_CONFIG_NO_EXCEPTIONS 0
144 # else
145 # define span_CONFIG_NO_EXCEPTIONS 1
146 # undef span_CONFIG_CONTRACT_VIOLATION_THROWS
147 # undef span_CONFIG_CONTRACT_VIOLATION_TERMINATES
148 # define span_CONFIG_CONTRACT_VIOLATION_THROWS 0
149 # define span_CONFIG_CONTRACT_VIOLATION_TERMINATES 1
150 # endif
151 #endif
152 
153 // Control pre- and postcondition violation behaviour:
154 
155 #if defined( span_CONFIG_CONTRACT_LEVEL_ON )
156 # define span_CONFIG_CONTRACT_LEVEL_MASK 0x11
157 #elif defined( span_CONFIG_CONTRACT_LEVEL_OFF )
158 # define span_CONFIG_CONTRACT_LEVEL_MASK 0x00
159 #elif defined( span_CONFIG_CONTRACT_LEVEL_EXPECTS_ONLY )
160 # define span_CONFIG_CONTRACT_LEVEL_MASK 0x01
161 #elif defined( span_CONFIG_CONTRACT_LEVEL_ENSURES_ONLY )
162 # define span_CONFIG_CONTRACT_LEVEL_MASK 0x10
163 #else
164 # define span_CONFIG_CONTRACT_LEVEL_MASK 0x11
165 #endif
166 
167 #if defined( span_CONFIG_CONTRACT_VIOLATION_THROWS )
168 # define span_CONFIG_CONTRACT_VIOLATION_THROWS_V span_CONFIG_CONTRACT_VIOLATION_THROWS
169 #else
170 # define span_CONFIG_CONTRACT_VIOLATION_THROWS_V 0
171 #endif
172 
173 #if defined( span_CONFIG_CONTRACT_VIOLATION_THROWS ) && span_CONFIG_CONTRACT_VIOLATION_THROWS && \
174  defined( span_CONFIG_CONTRACT_VIOLATION_TERMINATES ) && span_CONFIG_CONTRACT_VIOLATION_TERMINATES
175 # error Please define none or one of span_CONFIG_CONTRACT_VIOLATION_THROWS and span_CONFIG_CONTRACT_VIOLATION_TERMINATES to 1, but not both.
176 #endif
177 
178 // C++ language version detection (C++20 is speculative):
179 // Note: VC14.0/1900 (VS2015) lacks too much from C++14.
180 
181 #ifndef span_CPLUSPLUS
182 # if defined(_MSVC_LANG ) && !defined(__clang__)
183 # define span_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG )
184 # else
185 # define span_CPLUSPLUS __cplusplus
186 # endif
187 #endif
188 
189 #define span_CPP98_OR_GREATER ( span_CPLUSPLUS >= 199711L )
190 #define span_CPP11_OR_GREATER ( span_CPLUSPLUS >= 201103L )
191 #define span_CPP14_OR_GREATER ( span_CPLUSPLUS >= 201402L )
192 #define span_CPP17_OR_GREATER ( span_CPLUSPLUS >= 201703L )
193 #define span_CPP20_OR_GREATER ( span_CPLUSPLUS >= 202000L )
194 
195 // C++ language version (represent 98 as 3):
196 
197 #define span_CPLUSPLUS_V ( span_CPLUSPLUS / 100 - (span_CPLUSPLUS > 200000 ? 2000 : 1994) )
198 
199 #define span_IN_STD( v ) ( ((v) == 98 ? 3 : (v)) >= span_CPLUSPLUS_V )
200 
201 #define span_CONFIG( feature ) ( span_CONFIG_##feature )
202 #define span_FEATURE( feature ) ( span_FEATURE_##feature )
203 #define span_FEATURE_TO_STD( feature ) ( span_IN_STD( span_FEATURE( feature##_TO_STD ) ) )
204 
205 // Use C++20 std::span if available and requested:
206 
207 #if span_CPP20_OR_GREATER && defined(__has_include )
208 # if __has_include( <span> )
209 # define span_HAVE_STD_SPAN 1
210 # else
211 # define span_HAVE_STD_SPAN 0
212 # endif
213 #else
214 # define span_HAVE_STD_SPAN 0
215 #endif
216 
217 #define span_USES_STD_SPAN ( (span_CONFIG_SELECT_SPAN == span_SPAN_STD) || ((span_CONFIG_SELECT_SPAN == span_SPAN_DEFAULT) && span_HAVE_STD_SPAN) )
218 
219 //
220 // Use C++20 std::span:
221 //
222 
223 #if span_USES_STD_SPAN
224 
225 #include <span>
226 
227 namespace nonstd {
228 
229 using std::span;
230 
231 // Note: C++20 does not provide comparison
232 // using std::operator==;
233 // using std::operator!=;
234 // using std::operator<;
235 // using std::operator<=;
236 // using std::operator>;
237 // using std::operator>=;
238 } // namespace nonstd
239 
240 #else // span_USES_STD_SPAN
241 
242 #include <algorithm>
243 
244 // Compiler versions:
245 //
246 // MSVC++ 6.0 _MSC_VER == 1200 span_COMPILER_MSVC_VERSION == 60 (Visual Studio 6.0)
247 // MSVC++ 7.0 _MSC_VER == 1300 span_COMPILER_MSVC_VERSION == 70 (Visual Studio .NET 2002)
248 // MSVC++ 7.1 _MSC_VER == 1310 span_COMPILER_MSVC_VERSION == 71 (Visual Studio .NET 2003)
249 // MSVC++ 8.0 _MSC_VER == 1400 span_COMPILER_MSVC_VERSION == 80 (Visual Studio 2005)
250 // MSVC++ 9.0 _MSC_VER == 1500 span_COMPILER_MSVC_VERSION == 90 (Visual Studio 2008)
251 // MSVC++ 10.0 _MSC_VER == 1600 span_COMPILER_MSVC_VERSION == 100 (Visual Studio 2010)
252 // MSVC++ 11.0 _MSC_VER == 1700 span_COMPILER_MSVC_VERSION == 110 (Visual Studio 2012)
253 // MSVC++ 12.0 _MSC_VER == 1800 span_COMPILER_MSVC_VERSION == 120 (Visual Studio 2013)
254 // MSVC++ 14.0 _MSC_VER == 1900 span_COMPILER_MSVC_VERSION == 140 (Visual Studio 2015)
255 // MSVC++ 14.1 _MSC_VER >= 1910 span_COMPILER_MSVC_VERSION == 141 (Visual Studio 2017)
256 // MSVC++ 14.2 _MSC_VER >= 1920 span_COMPILER_MSVC_VERSION == 142 (Visual Studio 2019)
257 
258 #if defined(_MSC_VER ) && !defined(__clang__)
259 # define span_COMPILER_MSVC_VER (_MSC_VER )
260 # define span_COMPILER_MSVC_VERSION (_MSC_VER / 10 - 10 * ( 5 + (_MSC_VER < 1900 ) ) )
261 #else
262 # define span_COMPILER_MSVC_VER 0
263 # define span_COMPILER_MSVC_VERSION 0
264 #endif
265 
266 #define span_COMPILER_VERSION( major, minor, patch ) ( 10 * ( 10 * (major) + (minor) ) + (patch) )
267 
268 #if defined(__clang__)
269 # define span_COMPILER_CLANG_VERSION span_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
270 #else
271 # define span_COMPILER_CLANG_VERSION 0
272 #endif
273 
274 #if defined(__GNUC__) && !defined(__clang__)
275 # define span_COMPILER_GNUC_VERSION span_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
276 #else
277 # define span_COMPILER_GNUC_VERSION 0
278 #endif
279 
280 // half-open range [lo..hi):
281 #define span_BETWEEN( v, lo, hi ) ( (lo) <= (v) && (v) < (hi) )
282 
283 // Compiler warning suppression:
284 
285 #if defined(__clang__)
286 # pragma clang diagnostic push
287 # pragma clang diagnostic ignored "-Wundef"
288 # pragma clang diagnostic ignored "-Wmismatched-tags"
289 # define span_RESTORE_WARNINGS() _Pragma( "clang diagnostic pop" )
290 
291 #elif defined __GNUC__
292 # pragma GCC diagnostic push
293 # pragma GCC diagnostic ignored "-Wundef"
294 # define span_RESTORE_WARNINGS() _Pragma( "GCC diagnostic pop" )
295 
296 #elif span_COMPILER_MSVC_VER >= 1900
297 # define span_DISABLE_MSVC_WARNINGS(codes) __pragma(warning(push)) __pragma(warning(disable: codes))
298 # define span_RESTORE_WARNINGS() __pragma(warning(pop ))
299 
300 // Suppress the following MSVC GSL warnings:
301 // - C26439, gsl::f.6 : special function 'function' can be declared 'noexcept'
302 // - C26440, gsl::f.6 : function 'function' can be declared 'noexcept'
303 // - C26472, gsl::t.1 : don't use a static_cast for arithmetic conversions;
304 // use brace initialization, gsl::narrow_cast or gsl::narrow
305 // - C26473: gsl::t.1 : don't cast between pointer types where the source type and the target type are the same
306 // - C26481: gsl::b.1 : don't use pointer arithmetic. Use span instead
307 // - C26490: gsl::t.1 : don't use reinterpret_cast
308 
309 span_DISABLE_MSVC_WARNINGS( 26439 26440 26472 26473 26481 26490 )
310 
311 #else
312 # define span_RESTORE_WARNINGS() /*empty*/
313 #endif
314 
315 // Presence of language and library features:
316 
317 #ifdef _HAS_CPP0X
318 # define span_HAS_CPP0X _HAS_CPP0X
319 #else
320 # define span_HAS_CPP0X 0
321 #endif
322 
323 #define span_CPP11_80 (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1400)
324 #define span_CPP11_90 (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1500)
325 #define span_CPP11_100 (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1600)
326 #define span_CPP11_110 (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1700)
327 #define span_CPP11_120 (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1800)
328 #define span_CPP11_140 (span_CPP11_OR_GREATER || span_COMPILER_MSVC_VER >= 1900)
329 
330 #define span_CPP14_000 (span_CPP14_OR_GREATER)
331 #define span_CPP14_120 (span_CPP14_OR_GREATER || span_COMPILER_MSVC_VER >= 1800)
332 #define span_CPP14_140 (span_CPP14_OR_GREATER || span_COMPILER_MSVC_VER >= 1900)
333 
334 #define span_CPP17_000 (span_CPP17_OR_GREATER)
335 
336 // Presence of C++11 language features:
337 
338 #define span_HAVE_ALIAS_TEMPLATE span_CPP11_140
339 #define span_HAVE_AUTO span_CPP11_100
340 #define span_HAVE_CONSTEXPR_11 span_CPP11_140
341 #define span_HAVE_DEFAULT_FUNCTION_TEMPLATE_ARG span_CPP11_120
342 #define span_HAVE_EXPLICIT_CONVERSION span_CPP11_140
343 #define span_HAVE_INITIALIZER_LIST span_CPP11_120
344 #define span_HAVE_IS_DEFAULT span_CPP11_140
345 #define span_HAVE_IS_DELETE span_CPP11_140
346 #define span_HAVE_NOEXCEPT span_CPP11_140
347 #define span_HAVE_NULLPTR span_CPP11_100
348 #define span_HAVE_STATIC_ASSERT span_CPP11_100
349 
350 // Presence of C++14 language features:
351 
352 #define span_HAVE_CONSTEXPR_14 span_CPP14_000
353 
354 // Presence of C++17 language features:
355 
356 #define span_HAVE_DEPRECATED span_CPP17_000
357 #define span_HAVE_NODISCARD span_CPP17_000
358 #define span_HAVE_NORETURN span_CPP17_000
359 
360 // MSVC: template parameter deduction guides since Visual Studio 2017 v15.7
361 
362 #if defined(__cpp_deduction_guides)
363 # define span_HAVE_DEDUCTION_GUIDES 1
364 #else
365 # define span_HAVE_DEDUCTION_GUIDES (span_CPP17_OR_GREATER && ! span_BETWEEN( span_COMPILER_MSVC_VER, 1, 1913 ))
366 #endif
367 
368 // Presence of C++ library features:
369 
370 #define span_HAVE_ADDRESSOF span_CPP17_000
371 #define span_HAVE_ARRAY span_CPP11_110
372 #define span_HAVE_BYTE span_CPP17_000
373 #define span_HAVE_CONDITIONAL span_CPP11_120
374 #define span_HAVE_CONTAINER_DATA_METHOD (span_CPP11_140 || ( span_COMPILER_MSVC_VER >= 1500 && span_HAS_CPP0X ))
375 #define span_HAVE_DATA span_CPP17_000
376 #define span_HAVE_LONGLONG span_CPP11_80
377 #define span_HAVE_REMOVE_CONST span_CPP11_110
378 #define span_HAVE_SNPRINTF span_CPP11_140
379 #define span_HAVE_STRUCT_BINDING span_CPP11_120
380 #define span_HAVE_TYPE_TRAITS span_CPP11_90
381 
382 // Presence of byte-lite:
383 
384 #ifdef NONSTD_BYTE_LITE_HPP
385 # define span_HAVE_NONSTD_BYTE 1
386 #else
387 # define span_HAVE_NONSTD_BYTE 0
388 #endif
389 
390 // C++ feature usage:
391 
392 #if span_HAVE_ADDRESSOF
393 # define span_ADDRESSOF(x) std::addressof(x)
394 #else
395 # define span_ADDRESSOF(x) (&x)
396 #endif
397 
398 #if span_HAVE_CONSTEXPR_11
399 # define span_constexpr constexpr
400 #else
401 # define span_constexpr /*span_constexpr*/
402 #endif
403 
404 #if span_HAVE_CONSTEXPR_14
405 # define span_constexpr14 constexpr
406 #else
407 # define span_constexpr14 /*span_constexpr*/
408 #endif
409 
410 #if span_HAVE_EXPLICIT_CONVERSION
411 # define span_explicit explicit
412 #else
413 # define span_explicit /*explicit*/
414 #endif
415 
416 #if span_HAVE_IS_DELETE
417 # define span_is_delete = delete
418 #else
419 # define span_is_delete
420 #endif
421 
422 #if span_HAVE_IS_DELETE
423 # define span_is_delete_access public
424 #else
425 # define span_is_delete_access private
426 #endif
427 
428 #if span_HAVE_NOEXCEPT && ! span_CONFIG_CONTRACT_VIOLATION_THROWS_V
429 # define span_noexcept noexcept
430 #else
431 # define span_noexcept /*noexcept*/
432 #endif
433 
434 #if span_HAVE_NULLPTR
435 # define span_nullptr nullptr
436 #else
437 # define span_nullptr NULL
438 #endif
439 
440 #if span_HAVE_DEPRECATED
441 # define span_deprecated(msg) [[deprecated(msg)]]
442 #else
443 # define span_deprecated(msg) /*[[deprecated]]*/
444 #endif
445 
446 #if span_HAVE_NODISCARD
447 # define span_nodiscard [[nodiscard]]
448 #else
449 # define span_nodiscard /*[[nodiscard]]*/
450 #endif
451 
452 #if span_HAVE_NORETURN
453 # define span_noreturn [[noreturn]]
454 #else
455 # define span_noreturn /*[[noreturn]]*/
456 #endif
457 
458 // Other features:
459 
460 #define span_HAVE_CONSTRAINED_SPAN_CONTAINER_CTOR span_HAVE_DEFAULT_FUNCTION_TEMPLATE_ARG
461 #define span_HAVE_ITERATOR_CTOR span_HAVE_DEFAULT_FUNCTION_TEMPLATE_ARG
462 
463 // Additional includes:
464 
465 #if span_HAVE( ADDRESSOF )
466 # include <memory>
467 #endif
468 
469 #if span_HAVE( ARRAY )
470 # include <array>
471 #endif
472 
473 #if span_HAVE( BYTE )
474 # include <cstddef>
475 #endif
476 
477 #if span_HAVE( DATA )
478 # include <iterator> // for std::data(), std::size()
479 #endif
480 
481 #if span_HAVE( TYPE_TRAITS )
482 # include <type_traits>
483 #endif
484 
485 #if ! span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
486 # include <vector>
487 #endif
488 
489 #if span_FEATURE( MEMBER_AT ) > 1
490 # include <cstdio>
491 #endif
492 
493 #if ! span_CONFIG( NO_EXCEPTIONS )
494 # include <stdexcept>
495 #endif
496 
497 // Contract violation
498 
499 #define span_ELIDE_CONTRACT_EXPECTS ( 0 == ( span_CONFIG_CONTRACT_LEVEL_MASK & 0x01 ) )
500 #define span_ELIDE_CONTRACT_ENSURES ( 0 == ( span_CONFIG_CONTRACT_LEVEL_MASK & 0x10 ) )
501 
502 #if span_ELIDE_CONTRACT_EXPECTS
503 # define span_constexpr_exp span_constexpr
504 # define span_EXPECTS( cond ) /* Expect elided */
505 #else
506 # define span_constexpr_exp span_constexpr14
507 # define span_EXPECTS( cond ) span_CONTRACT_CHECK( "Precondition", cond )
508 #endif
509 
510 #if span_ELIDE_CONTRACT_ENSURES
511 # define span_constexpr_ens span_constexpr
512 # define span_ENSURES( cond ) /* Ensures elided */
513 #else
514 # define span_constexpr_ens span_constexpr14
515 # define span_ENSURES( cond ) span_CONTRACT_CHECK( "Postcondition", cond )
516 #endif
517 
518 #define span_CONTRACT_CHECK( type, cond ) \
519  cond ? static_cast< void >( 0 ) \
520  : nonstd::span_lite::detail::report_contract_violation( span_LOCATION( __FILE__, __LINE__ ) ": " type " violation." )
521 
522 #ifdef __GNUG__
523 # define span_LOCATION( file, line ) file ":" span_STRINGIFY( line )
524 #else
525 # define span_LOCATION( file, line ) file "(" span_STRINGIFY( line ) ")"
526 #endif
527 
528 // Method enabling
529 
530 #if span_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG )
531 
532 #define span_REQUIRES_0(VA) \
533  template< bool B = (VA), typename std::enable_if<B, int>::type = 0 >
534 
535 # if span_BETWEEN( span_COMPILER_MSVC_VERSION, 1, 140 )
536 // VS 2013 and earlier seem to have trouble with SFINAE for default non-type arguments
537 # define span_REQUIRES_T(VA) \
538  , typename = typename std::enable_if< ( VA ), nonstd::span_lite::detail::enabler >::type
539 # else
540 # define span_REQUIRES_T(VA) \
541  , typename std::enable_if< (VA), int >::type = 0
542 # endif
543 
544 #define span_REQUIRES_R(R, VA) \
545  typename std::enable_if< (VA), R>::type
546 
547 #define span_REQUIRES_A(VA) \
548  , typename std::enable_if< (VA), void*>::type = nullptr
549 
550 #else
551 
552 # define span_REQUIRES_0(VA) /*empty*/
553 # define span_REQUIRES_T(VA) /*empty*/
554 # define span_REQUIRES_R(R, VA) R
555 # define span_REQUIRES_A(VA) /*empty*/
556 
557 #endif
558 
559 namespace nonstd {
560 namespace span_lite {
561 
562 // [views.constants], constants
563 
566 
567 span_constexpr const extent_t dynamic_extent = static_cast<extent_t>( -1 );
568 
569 template< class T, extent_t Extent = dynamic_extent >
570 class span;
571 
572 // Tag to select span constructor taking a container (prevent ms-gsl warning C26426):
573 
576 
577 // C++11 emulation:
578 
579 namespace std11 {
580 
581 #if span_HAVE( REMOVE_CONST )
582 
583 using std::remove_cv;
584 using std::remove_const;
585 using std::remove_volatile;
586 
587 #else
588 
589 template< class T > struct remove_const { typedef T type; };
590 template< class T > struct remove_const< T const > { typedef T type; };
591 
592 template< class T > struct remove_volatile { typedef T type; };
593 template< class T > struct remove_volatile< T volatile > { typedef T type; };
594 
595 template< class T >
596 struct remove_cv
597 {
599 };
600 
601 #endif // span_HAVE( REMOVE_CONST )
602 
603 #if span_HAVE( TYPE_TRAITS )
604 
605 using std::is_same;
606 using std::is_signed;
607 using std::integral_constant;
608 using std::true_type;
609 using std::false_type;
610 using std::remove_reference;
611 
612 #else
613 
614 template< class T, T v > struct integral_constant { enum { value = v }; };
617 
618 template< class T, class U > struct is_same : false_type{};
619 template< class T > struct is_same<T, T> : true_type{};
620 
621 template< typename T > struct is_signed : false_type {};
622 template<> struct is_signed<signed char> : true_type {};
623 template<> struct is_signed<signed int > : true_type {};
624 template<> struct is_signed<signed long> : true_type {};
625 
626 #endif
627 
628 } // namespace std11
629 
630 // C++17 emulation:
631 
632 namespace std17 {
633 
634 template< bool v > struct bool_constant : std11::integral_constant<bool, v>{};
635 
636 #if span_CPP11_120
637 
638 template< class...>
639 using void_t = void;
640 
641 #endif
642 
643 #if span_HAVE( DATA )
644 
645 using std::data;
646 using std::size;
647 
648 #elif span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
649 
650 template< typename T, std::size_t N >
651 inline span_constexpr auto size( const T(&)[N] ) span_noexcept -> size_t
652 {
653  return N;
654 }
655 
656 template< typename C >
657 inline span_constexpr auto size( C const & cont ) -> decltype( cont.size() )
658 {
659  return cont.size();
660 }
661 
662 template< typename T, std::size_t N >
663 inline span_constexpr auto data( T(&arr)[N] ) span_noexcept -> T*
664 {
665  return &arr[0];
666 }
667 
668 template< typename C >
669 inline span_constexpr auto data( C & cont ) -> decltype( cont.data() )
670 {
671  return cont.data();
672 }
673 
674 template< typename C >
675 inline span_constexpr auto data( C const & cont ) -> decltype( cont.data() )
676 {
677  return cont.data();
678 }
679 
680 template< typename E >
681 inline span_constexpr auto data( std::initializer_list<E> il ) span_noexcept -> E const *
682 {
683  return il.begin();
684 }
685 
686 #endif // span_HAVE( DATA )
687 
688 #if span_HAVE( BYTE )
689 using std::byte;
690 #elif span_HAVE( NONSTD_BYTE )
691 using nonstd::byte;
692 #endif
693 
694 } // namespace std17
695 
696 // C++20 emulation:
697 
698 namespace std20 {
699 
700 #if span_HAVE( DEDUCTION_GUIDES )
701 template< class T >
702 using iter_reference_t = decltype( *std::declval<T&>() );
703 #endif
704 
705 } // namespace std20
706 
707 // Implementation details:
708 
709 namespace detail {
710 
711 /*enum*/ struct enabler{};
712 
713 template< typename T >
715 {
716  return std11::is_signed<T>::value ? x >= 0 : true;
717 }
718 
719 #if span_HAVE( TYPE_TRAITS )
720 
721 template< class Q >
722 struct is_span_oracle : std::false_type{};
723 
724 template< class T, span_CONFIG_EXTENT_TYPE Extent >
725 struct is_span_oracle< span<T, Extent> > : std::true_type{};
726 
727 template< class Q >
728 struct is_span : is_span_oracle< typename std::remove_cv<Q>::type >{};
729 
730 template< class Q >
731 struct is_std_array_oracle : std::false_type{};
732 
733 #if span_HAVE( ARRAY )
734 
735 template< class T, std::size_t Extent >
736 struct is_std_array_oracle< std::array<T, Extent> > : std::true_type{};
737 
738 #endif
739 
740 template< class Q >
741 struct is_std_array : is_std_array_oracle< typename std::remove_cv<Q>::type >{};
742 
743 template< class Q >
744 struct is_array : std::false_type {};
745 
746 template< class T >
747 struct is_array<T[]> : std::true_type {};
748 
749 template< class T, std::size_t N >
750 struct is_array<T[N]> : std::true_type {};
751 
752 #if span_CPP11_140 && ! span_BETWEEN( span_COMPILER_GNUC_VERSION, 1, 500 )
753 
754 template< class, class = void >
755 struct has_size_and_data : std::false_type{};
756 
757 template< class C >
758 struct has_size_and_data
759 <
760  C, std17::void_t<
761  decltype( std17::size(std::declval<C>()) ),
762  decltype( std17::data(std::declval<C>()) ) >
763 > : std::true_type{};
764 
765 template< class, class, class = void >
766 struct is_compatible_element : std::false_type {};
767 
768 template< class C, class E >
769 struct is_compatible_element
770 <
771  C, E, std17::void_t<
772  decltype( std17::data(std::declval<C>()) ) >
773 > : std::is_convertible< typename std::remove_pointer<decltype( std17::data( std::declval<C&>() ) )>::type(*)[], E(*)[] >{};
774 
775 template< class C >
776 struct is_container : std17::bool_constant
777 <
778  ! is_span< C >::value
779  && ! is_array< C >::value
780  && ! is_std_array< C >::value
781  && has_size_and_data< C >::value
782 >{};
783 
784 template< class C, class E >
785 struct is_compatible_container : std17::bool_constant
786 <
787  is_container<C>::value
788  && is_compatible_element<C,E>::value
789 >{};
790 
791 #else // span_CPP11_140
792 
793 template<
794  class C, class E
799  && ( std::is_convertible< typename std::remove_pointer<decltype( std17::data( std::declval<C&>() ) )>::type(*)[], E(*)[] >::value)
800  // && has_size_and_data< C >::value
801  ))
802  , class = decltype( std17::size(std::declval<C>()) )
803  , class = decltype( std17::data(std::declval<C>()) )
804 >
805 struct is_compatible_container : std::true_type{};
806 
807 #endif // span_CPP11_140
808 
809 #endif // span_HAVE( TYPE_TRAITS )
810 
811 #if ! span_CONFIG( NO_EXCEPTIONS )
812 #if span_FEATURE( MEMBER_AT ) > 1
813 
814 // format index and size:
815 
816 #if defined(__clang__)
817 # pragma clang diagnostic ignored "-Wlong-long"
818 #elif defined __GNUC__
819 # pragma GCC diagnostic ignored "-Wformat=ll"
820 # pragma GCC diagnostic ignored "-Wlong-long"
821 #endif
822 
823 span_noreturn inline void throw_out_of_range( size_t idx, size_t size )
824 {
825  const char fmt[] = "span::at(): index '%lli' is out of range [0..%lli)";
826  char buffer[ 2 * 20 + sizeof fmt ];
827  sprintf( buffer, fmt, static_cast<long long>(idx), static_cast<long long>(size) );
828 
829  throw std::out_of_range( buffer );
830 }
831 
832 #else // MEMBER_AT
833 
834 span_noreturn inline void throw_out_of_range( size_t /*idx*/, size_t /*size*/ )
835 {
836  throw std::out_of_range( "span::at(): index outside span" );
837 }
838 #endif // MEMBER_AT
839 #endif // NO_EXCEPTIONS
840 
841 #if span_CONFIG( CONTRACT_VIOLATION_THROWS_V )
842 
843 struct contract_violation : std::logic_error
844 {
845  explicit contract_violation( char const * const message )
846  : std::logic_error( message )
847  {}
848 };
849 
850 inline void report_contract_violation( char const * msg )
851 {
852  throw contract_violation( msg );
853 }
854 
855 #else // span_CONFIG( CONTRACT_VIOLATION_THROWS_V )
856 
857 span_noreturn inline void report_contract_violation( char const * /*msg*/ ) span_noexcept
858 {
859  std::terminate();
860 }
861 
862 #endif // span_CONFIG( CONTRACT_VIOLATION_THROWS_V )
863 
864 } // namespace detail
865 
866 // Prevent signed-unsigned mismatch:
867 
868 #define span_sizeof(T) static_cast<extent_t>( sizeof(T) )
869 
870 template< class T >
871 inline span_constexpr size_t to_size( T size )
872 {
873  return static_cast<size_t>( size );
874 }
875 
876 //
877 // [views.span] - A view over a contiguous, single-dimension sequence of objects
878 //
879 template< class T, extent_t Extent /*= dynamic_extent*/ >
880 class span
881 {
882 public:
883  // constants and types
884 
885  typedef T element_type;
887 
888  typedef T & reference;
889  typedef T * pointer;
890  typedef T const * const_pointer;
891  typedef T const & const_reference;
892 
893  typedef size_t size_type;
894  typedef extent_t extent_type;
895 
896  typedef pointer iterator;
897  typedef const_pointer const_iterator;
898 
899  typedef std::ptrdiff_t difference_type;
900 
901  typedef std::reverse_iterator< iterator > reverse_iterator;
902  typedef std::reverse_iterator< const_iterator > const_reverse_iterator;
903 
904 // static constexpr extent_type extent = Extent;
905  enum { extent = Extent };
906 
907  // 26.7.3.2 Constructors, copy, and assignment [span.cons]
908 
910  ( Extent == 0 ) ||
911  ( Extent == dynamic_extent )
912  )
914  : data_( span_nullptr )
915  , size_( 0 )
916  {
917  // span_EXPECTS( data() == span_nullptr );
918  // span_EXPECTS( size() == 0 );
919  }
920 
921 #if span_HAVE( ITERATOR_CTOR )
922  // Didn't yet succeed in combining the next two constructors:
923 
924  span_constexpr_exp span( std::nullptr_t, size_type count )
925  : data_( span_nullptr )
926  , size_( count )
927  {
928  span_EXPECTS( data_ == span_nullptr && count == 0 );
929  }
930 
931  template< typename It
933  std::is_convertible<decltype(*std::declval<It&>()), element_type &>::value
934  ))
935  >
936  span_constexpr_exp span( It first, size_type count )
937  : data_( to_address( first ) )
938  , size_( count )
939  {
940  span_EXPECTS(
941  ( data_ == span_nullptr && count == 0 ) ||
942  ( data_ != span_nullptr && detail::is_positive( count ) )
943  );
944  }
945 #else
946  span_constexpr_exp span( pointer ptr, size_type count )
947  : data_( ptr )
948  , size_( count )
949  {
950  span_EXPECTS(
951  ( ptr == span_nullptr && count == 0 ) ||
952  ( ptr != span_nullptr && detail::is_positive( count ) )
953  );
954  }
955 #endif
956 
957 #if span_HAVE( ITERATOR_CTOR )
958  template< typename It, typename End
960  std::is_convertible<decltype(&*std::declval<It&>()), element_type *>::value
962  ))
963  >
964  span_constexpr_exp span( It first, End last )
965  : data_( to_address( first ) )
966  , size_( to_size( last - first ) )
967  {
968  span_EXPECTS(
969  last - first >= 0
970  );
971  }
972 #else
973  span_constexpr_exp span( pointer first, pointer last )
974  : data_( first )
975  , size_( to_size( last - first ) )
976  {
977  span_EXPECTS(
978  last - first >= 0
979  );
980  }
981 #endif
982 
983  template< std::size_t N
985  (Extent == dynamic_extent || Extent == static_cast<extent_t>(N))
986  && std::is_convertible< value_type(*)[], element_type(*)[] >::value
987  ))
988  >
989  span_constexpr span( element_type ( &arr )[ N ] ) span_noexcept
990  : data_( span_ADDRESSOF( arr[0] ) )
991  , size_( N )
992  {}
993 
994 #if span_HAVE( ARRAY )
995 
996  template< std::size_t N
998  (Extent == dynamic_extent || Extent == static_cast<extent_t>(N))
999  && std::is_convertible< value_type(*)[], element_type(*)[] >::value
1000  ))
1001  >
1002 # if span_FEATURE( CONSTRUCTION_FROM_STDARRAY_ELEMENT_TYPE )
1003  span_constexpr span( std::array< element_type, N > & arr ) span_noexcept
1004 # else
1005  span_constexpr span( std::array< value_type, N > & arr ) span_noexcept
1006 # endif
1007  : data_( arr.data() )
1008  , size_( to_size( arr.size() ) )
1009  {}
1010 
1011  template< std::size_t N
1012 # if span_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG )
1013  span_REQUIRES_T((
1014  (Extent == dynamic_extent || Extent == static_cast<extent_t>(N))
1015  && std::is_convertible< value_type(*)[], element_type(*)[] >::value
1016  ))
1017 # endif
1018  >
1019  span_constexpr span( std::array< value_type, N> const & arr ) span_noexcept
1020  : data_( arr.data() )
1021  , size_( to_size( arr.size() ) )
1022  {}
1023 
1024 #endif // span_HAVE( ARRAY )
1025 
1026 #if span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
1027  template< class Container
1028  span_REQUIRES_T((
1030  ))
1031  >
1032  span_constexpr span( Container & cont )
1033  : data_( std17::data( cont ) )
1034  , size_( to_size( std17::size( cont ) ) )
1035  {}
1036 
1037  template< class Container
1038  span_REQUIRES_T((
1041  ))
1042  >
1043  span_constexpr span( Container const & cont )
1044  : data_( std17::data( cont ) )
1045  , size_( to_size( std17::size( cont ) ) )
1046  {}
1047 
1048 #endif // span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
1049 
1050 #if span_FEATURE( WITH_CONTAINER )
1051 
1052  template< class Container >
1053  span_constexpr span( with_container_t, Container & cont )
1054  : data_( cont.size() == 0 ? span_nullptr : span_ADDRESSOF( cont[0] ) )
1055  , size_( to_size( cont.size() ) )
1056  {}
1057 
1058  template< class Container >
1059  span_constexpr span( with_container_t, Container const & cont )
1060  : data_( cont.size() == 0 ? span_nullptr : const_cast<pointer>( span_ADDRESSOF( cont[0] ) ) )
1061  , size_( to_size( cont.size() ) )
1062  {}
1063 #endif
1064 
1065 #if span_FEATURE( WITH_INITIALIZER_LIST_P2447 ) && span_HAVE( INITIALIZER_LIST )
1066 
1067  // constexpr explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il) noexcept;
1068 
1069 #if !span_BETWEEN( span_COMPILER_MSVC_VERSION, 120, 130 )
1070 
1071  template< extent_t U = Extent
1072  span_REQUIRES_T((
1073  U != dynamic_extent
1074  ))
1075  >
1076 #if span_COMPILER_GNUC_VERSION >= 900 // prevent GCC's "-Winit-list-lifetime"
1077  span_constexpr14 explicit span( std::initializer_list<value_type> il ) span_noexcept
1078  {
1079  data_ = il.begin();
1080  size_ = il.size();
1081  }
1082 #else
1083  span_constexpr explicit span( std::initializer_list<value_type> il ) span_noexcept
1084  : data_( il.begin() )
1085  , size_( il.size() )
1086  {}
1087 #endif
1088 
1089 #endif // MSVC 120 (VS2013)
1090 
1091  template< extent_t U = Extent
1092  span_REQUIRES_T((
1093  U == dynamic_extent
1094  ))
1095  >
1096 #if span_COMPILER_GNUC_VERSION >= 900 // prevent GCC's "-Winit-list-lifetime"
1097  span_constexpr14 /*explicit*/ span( std::initializer_list<value_type> il ) span_noexcept
1098  {
1099  data_ = il.begin();
1100  size_ = il.size();
1101  }
1102 #else
1103  span_constexpr /*explicit*/ span( std::initializer_list<value_type> il ) span_noexcept
1104  : data_( il.begin() )
1105  , size_( il.size() )
1106  {}
1107 #endif
1108 
1109 #endif // P2447
1110 
1111 #if span_HAVE( IS_DEFAULT )
1112  span_constexpr span( span const & other ) span_noexcept = default;
1113 
1114  ~span() span_noexcept = default;
1115 
1116  span_constexpr14 span & operator=( span const & other ) span_noexcept = default;
1117 #else
1118  span_constexpr span( span const & other ) span_noexcept
1119  : data_( other.data_ )
1120  , size_( other.size_ )
1121  {}
1122 
1123  ~span() span_noexcept
1124  {}
1125 
1126  span_constexpr14 span & operator=( span const & other ) span_noexcept
1127  {
1128  data_ = other.data_;
1129  size_ = other.size_;
1130 
1131  return *this;
1132  }
1133 #endif
1134 
1135  template< class OtherElementType, extent_type OtherExtent
1136  span_REQUIRES_T((
1137  (Extent == dynamic_extent || OtherExtent == dynamic_extent || Extent == OtherExtent)
1138  && std::is_convertible<OtherElementType(*)[], element_type(*)[]>::value
1139  ))
1140  >
1142  : data_( other.data() )
1143  , size_( other.size() )
1144  {
1145  span_EXPECTS( OtherExtent == dynamic_extent || other.size() == to_size(OtherExtent) );
1146  }
1147 
1148  // 26.7.3.3 Subviews [span.sub]
1149 
1150  template< extent_type Count >
1152  first() const
1153  {
1155 
1156  return span< element_type, Count >( data(), Count );
1157  }
1158 
1159  template< extent_type Count >
1161  last() const
1162  {
1164 
1165  return span< element_type, Count >( data() + (size() - Count), Count );
1166  }
1167 
1168 #if span_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG )
1169  template< size_type Offset, extent_type Count = dynamic_extent >
1170 #else
1171  template< size_type Offset, extent_type Count /*= dynamic_extent*/ >
1172 #endif
1174  subspan() const
1175  {
1176  span_EXPECTS(
1177  ( detail::is_positive( Offset ) && Offset <= size() ) &&
1178  ( Count == dynamic_extent || (detail::is_positive( Count ) && Count + Offset <= size()) )
1179  );
1180 
1182  data() + Offset, Count != dynamic_extent ? Count : (Extent != dynamic_extent ? Extent - Offset : size() - Offset) );
1183  }
1184 
1186  first( size_type count ) const
1187  {
1188  span_EXPECTS( detail::is_positive( count ) && count <= size() );
1189 
1190  return span< element_type, dynamic_extent >( data(), count );
1191  }
1192 
1194  last( size_type count ) const
1195  {
1196  span_EXPECTS( detail::is_positive( count ) && count <= size() );
1197 
1198  return span< element_type, dynamic_extent >( data() + ( size() - count ), count );
1199  }
1200 
1202  subspan( size_type offset, size_type count = static_cast<size_type>(dynamic_extent) ) const
1203  {
1204  span_EXPECTS(
1205  ( ( detail::is_positive( offset ) && offset <= size() ) ) &&
1206  ( count == static_cast<size_type>(dynamic_extent) || ( detail::is_positive( count ) && offset + count <= size() ) )
1207  );
1208 
1210  data() + offset, count == static_cast<size_type>(dynamic_extent) ? size() - offset : count );
1211  }
1212 
1213  // 26.7.3.4 Observers [span.obs]
1214 
1215  span_constexpr size_type size() const span_noexcept
1216  {
1217  return size_;
1218  }
1219 
1220  span_constexpr std::ptrdiff_t ssize() const span_noexcept
1221  {
1222  return static_cast<std::ptrdiff_t>( size_ );
1223  }
1224 
1225  span_constexpr size_type size_bytes() const span_noexcept
1226  {
1227  return size() * to_size( sizeof( element_type ) );
1228  }
1229 
1230  span_nodiscard span_constexpr bool empty() const span_noexcept
1231  {
1232  return size() == 0;
1233  }
1234 
1235  // 26.7.3.5 Element access [span.elem]
1236 
1237  span_constexpr_exp reference operator[]( size_type idx ) const
1238  {
1239  span_EXPECTS( detail::is_positive( idx ) && idx < size() );
1240 
1241  return *( data() + idx );
1242  }
1243 
1244 #if span_FEATURE( MEMBER_CALL_OPERATOR )
1245  span_deprecated("replace operator() with operator[]")
1246 
1247  span_constexpr_exp reference operator()( size_type idx ) const
1248  {
1249  span_EXPECTS( detail::is_positive( idx ) && idx < size() );
1250 
1251  return *( data() + idx );
1252  }
1253 #endif
1254 
1255 #if span_FEATURE( MEMBER_AT )
1256  span_constexpr14 reference at( size_type idx ) const
1257  {
1258 #if span_CONFIG( NO_EXCEPTIONS )
1259  return this->operator[]( idx );
1260 #else
1261  if ( !detail::is_positive( idx ) || size() <= idx )
1262  {
1263  detail::throw_out_of_range( idx, size() );
1264  }
1265  return *( data() + idx );
1266 #endif
1267  }
1268 #endif
1269 
1270  span_constexpr pointer data() const span_noexcept
1271  {
1272  return data_;
1273  }
1274 
1275 #if span_FEATURE( MEMBER_BACK_FRONT )
1276 
1277  span_constexpr_exp reference front() const span_noexcept
1278  {
1279  span_EXPECTS( ! empty() );
1280 
1281  return *data();
1282  }
1283 
1284  span_constexpr_exp reference back() const span_noexcept
1285  {
1286  span_EXPECTS( ! empty() );
1287 
1288  return *( data() + size() - 1 );
1289  }
1290 
1291 #endif
1292 
1293  // xx.x.x.x Modifiers [span.modifiers]
1294 
1295 #if span_FEATURE( MEMBER_SWAP )
1296 
1297  span_constexpr14 void swap( span & other ) span_noexcept
1298  {
1299  using std::swap;
1300  swap( data_, other.data_ );
1301  swap( size_, other.size_ );
1302  }
1303 #endif
1304 
1305  // 26.7.3.6 Iterator support [span.iterators]
1306 
1307  span_constexpr iterator begin() const span_noexcept
1308  {
1309 #if span_CPP11_OR_GREATER
1310  return { data() };
1311 #else
1312  return iterator( data() );
1313 #endif
1314  }
1315 
1316  span_constexpr iterator end() const span_noexcept
1317  {
1318 #if span_CPP11_OR_GREATER
1319  return { data() + size() };
1320 #else
1321  return iterator( data() + size() );
1322 #endif
1323  }
1324 
1325  span_constexpr const_iterator cbegin() const span_noexcept
1326  {
1327 #if span_CPP11_OR_GREATER
1328  return { data() };
1329 #else
1330  return const_iterator( data() );
1331 #endif
1332  }
1333 
1334  span_constexpr const_iterator cend() const span_noexcept
1335  {
1336 #if span_CPP11_OR_GREATER
1337  return { data() + size() };
1338 #else
1339  return const_iterator( data() + size() );
1340 #endif
1341  }
1342 
1343  span_constexpr reverse_iterator rbegin() const span_noexcept
1344  {
1345  return reverse_iterator( end() );
1346  }
1347 
1348  span_constexpr reverse_iterator rend() const span_noexcept
1349  {
1350  return reverse_iterator( begin() );
1351  }
1352 
1353  span_constexpr const_reverse_iterator crbegin() const span_noexcept
1354  {
1355  return const_reverse_iterator ( cend() );
1356  }
1357 
1358  span_constexpr const_reverse_iterator crend() const span_noexcept
1359  {
1360  return const_reverse_iterator( cbegin() );
1361  }
1362 
1363 private:
1364 
1365  // Note: C++20 has std::pointer_traits<Ptr>::to_address( it );
1366 
1367 #if span_HAVE( ITERATOR_CTOR )
1368  static inline span_constexpr pointer to_address( std::nullptr_t ) span_noexcept
1369  {
1370  return nullptr;
1371  }
1372 
1373  template< typename U >
1374  static inline span_constexpr U * to_address( U * p ) span_noexcept
1375  {
1376  return p;
1377  }
1378 
1379  template< typename Ptr
1381  >
1382  static inline span_constexpr pointer to_address( Ptr const & it ) span_noexcept
1383  {
1384  return to_address( it.operator->() );
1385  }
1386 #endif // span_HAVE( ITERATOR_CTOR )
1387 
1388 private:
1389  pointer data_;
1390  size_type size_;
1391 };
1392 
1393 // class template argument deduction guides:
1394 
1395 #if span_HAVE( DEDUCTION_GUIDES )
1396 
1397 template< class T, size_t N >
1398 span( T (&)[N] ) -> span<T, static_cast<extent_t>(N)>;
1399 
1400 template< class T, size_t N >
1401 span( std::array<T, N> & ) -> span<T, static_cast<extent_t>(N)>;
1402 
1403 template< class T, size_t N >
1404 span( std::array<T, N> const & ) -> span<const T, static_cast<extent_t>(N)>;
1405 
1406 #if span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
1407 
1408 template< class Container >
1409 span( Container& ) -> span<typename Container::value_type>;
1410 
1411 template< class Container >
1412 span( Container const & ) -> span<const typename Container::value_type>;
1413 
1414 #endif
1415 
1416 // iterator: constraints: It satisfies contiguous_­iterator.
1417 
1418 template< class It, class EndOrSize >
1420 
1421 #endif // span_HAVE( DEDUCTION_GUIDES )
1422 
1423 // 26.7.3.7 Comparison operators [span.comparison]
1424 
1425 #if span_FEATURE( COMPARISON )
1426 #if span_FEATURE( SAME )
1427 
1428 template< class T1, extent_t E1, class T2, extent_t E2 >
1429 inline span_constexpr bool same( span<T1,E1> const & l, span<T2,E2> const & r ) span_noexcept
1430 {
1432  && l.size() == r.size()
1433  && static_cast<void const*>( l.data() ) == r.data();
1434 }
1435 
1436 #endif
1437 
1438 template< class T1, extent_t E1, class T2, extent_t E2 >
1439 inline span_constexpr bool operator==( span<T1,E1> const & l, span<T2,E2> const & r )
1440 {
1441  return
1442 #if span_FEATURE( SAME )
1443  same( l, r ) ||
1444 #endif
1445  ( l.size() == r.size() && std::equal( l.begin(), l.end(), r.begin() ) );
1446 }
1447 
1448 template< class T1, extent_t E1, class T2, extent_t E2 >
1449 inline span_constexpr bool operator<( span<T1,E1> const & l, span<T2,E2> const & r )
1450 {
1451  return std::lexicographical_compare( l.begin(), l.end(), r.begin(), r.end() );
1452 }
1453 
1454 template< class T1, extent_t E1, class T2, extent_t E2 >
1455 inline span_constexpr bool operator!=( span<T1,E1> const & l, span<T2,E2> const & r )
1456 {
1457  return !( l == r );
1458 }
1459 
1460 template< class T1, extent_t E1, class T2, extent_t E2 >
1461 inline span_constexpr bool operator<=( span<T1,E1> const & l, span<T2,E2> const & r )
1462 {
1463  return !( r < l );
1464 }
1465 
1466 template< class T1, extent_t E1, class T2, extent_t E2 >
1467 inline span_constexpr bool operator>( span<T1,E1> const & l, span<T2,E2> const & r )
1468 {
1469  return ( r < l );
1470 }
1471 
1472 template< class T1, extent_t E1, class T2, extent_t E2 >
1473 inline span_constexpr bool operator>=( span<T1,E1> const & l, span<T2,E2> const & r )
1474 {
1475  return !( l < r );
1476 }
1477 
1478 #endif // span_FEATURE( COMPARISON )
1479 
1480 // 26.7.2.6 views of object representation [span.objectrep]
1481 
1482 #if span_HAVE( BYTE ) || span_HAVE( NONSTD_BYTE )
1483 
1484 // Avoid MSVC 14.1 (1910), VS 2017: warning C4307: '*': integral constant overflow:
1485 
1486 template< typename T, extent_t Extent >
1487 struct BytesExtent
1488 {
1489 #if span_CPP11_OR_GREATER
1490  enum ET : extent_t { value = span_sizeof(T) * Extent };
1491 #else
1492  enum ET { value = span_sizeof(T) * Extent };
1493 #endif
1494 };
1495 
1496 template< typename T >
1497 struct BytesExtent< T, dynamic_extent >
1498 {
1499 #if span_CPP11_OR_GREATER
1500  enum ET : extent_t { value = dynamic_extent };
1501 #else
1502  enum ET { value = dynamic_extent };
1503 #endif
1504 };
1505 
1506 template< class T, extent_t Extent >
1508 as_bytes( span<T,Extent> spn ) span_noexcept
1509 {
1510 #if 0
1511  return { reinterpret_cast< std17::byte const * >( spn.data() ), spn.size_bytes() };
1512 #else
1514  reinterpret_cast< std17::byte const * >( spn.data() ), spn.size_bytes() ); // NOLINT
1515 #endif
1516 }
1517 
1518 template< class T, extent_t Extent >
1520 as_writable_bytes( span<T,Extent> spn ) span_noexcept
1521 {
1522 #if 0
1523  return { reinterpret_cast< std17::byte * >( spn.data() ), spn.size_bytes() };
1524 #else
1526  reinterpret_cast< std17::byte * >( spn.data() ), spn.size_bytes() ); // NOLINT
1527 #endif
1528 }
1529 
1530 #endif // span_HAVE( BYTE ) || span_HAVE( NONSTD_BYTE )
1531 
1532 // 27.8 Container and view access [iterator.container]
1533 
1534 template< class T, extent_t Extent /*= dynamic_extent*/ >
1536 {
1537  return static_cast<std::size_t>( spn.size() );
1538 }
1539 
1540 template< class T, extent_t Extent /*= dynamic_extent*/ >
1541 span_constexpr std::ptrdiff_t ssize( span<T,Extent> const & spn )
1542 {
1543  return static_cast<std::ptrdiff_t>( spn.size() );
1544 }
1545 
1546 } // namespace span_lite
1547 } // namespace nonstd
1548 
1549 // make available in nonstd:
1550 
1551 namespace nonstd {
1552 
1554 
1555 using span_lite::span;
1556 
1558 
1559 #if span_FEATURE( COMPARISON )
1560 #if span_FEATURE( SAME )
1561 using span_lite::same;
1562 #endif
1563 
1564 using span_lite::operator==;
1565 using span_lite::operator!=;
1566 using span_lite::operator<;
1567 using span_lite::operator<=;
1568 using span_lite::operator>;
1569 using span_lite::operator>=;
1570 #endif
1571 
1572 #if span_HAVE( BYTE )
1573 using span_lite::as_bytes;
1574 using span_lite::as_writable_bytes;
1575 #endif
1576 
1577 using span_lite::size;
1578 using span_lite::ssize;
1579 
1580 } // namespace nonstd
1581 
1582 #endif // span_USES_STD_SPAN
1583 
1584 // make_span() [span-lite extension]:
1585 
1586 #if span_FEATURE( MAKE_SPAN ) || span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_SPAN ) || span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_CONTAINER )
1587 
1588 #if span_USES_STD_SPAN
1589 # define span_constexpr constexpr
1590 # define span_noexcept noexcept
1591 # define span_nullptr nullptr
1592 # ifndef span_CONFIG_EXTENT_TYPE
1593 # define span_CONFIG_EXTENT_TYPE std::size_t
1594 # endif
1595 using extent_t = span_CONFIG_EXTENT_TYPE;
1596 #endif // span_USES_STD_SPAN
1597 
1598 namespace nonstd {
1599 namespace span_lite {
1600 
1601 template< class T >
1602 inline span_constexpr span<T>
1603 make_span( T * ptr, size_t count ) span_noexcept
1604 {
1605  return span<T>( ptr, count );
1606 }
1607 
1608 template< class T >
1609 inline span_constexpr span<T>
1610 make_span( T * first, T * last ) span_noexcept
1611 {
1612  return span<T>( first, last );
1613 }
1614 
1615 template< class T, std::size_t N >
1617 make_span( T ( &arr )[ N ] ) span_noexcept
1618 {
1619  return span<T, static_cast<extent_t>(N)>( &arr[ 0 ], N );
1620 }
1621 
1622 #if span_USES_STD_SPAN || span_HAVE( ARRAY )
1623 
1624 template< class T, std::size_t N >
1626 make_span( std::array< T, N > & arr ) span_noexcept
1627 {
1628  return span<T, static_cast<extent_t>(N)>( arr );
1629 }
1630 
1631 template< class T, std::size_t N >
1633 make_span( std::array< T, N > const & arr ) span_noexcept
1634 {
1635  return span<const T, static_cast<extent_t>(N)>( arr );
1636 }
1637 
1638 #endif // span_HAVE( ARRAY )
1639 
1640 #if span_USES_STD_SPAN || span_HAVE( INITIALIZER_LIST )
1641 
1642 template< class T >
1644 make_span( std::initializer_list<T> il ) span_noexcept
1645 {
1646  return span<const T>( il.begin(), il.size() );
1647 }
1648 
1649 #endif // span_HAVE( INITIALIZER_LIST )
1650 
1651 #if span_USES_STD_SPAN
1652 
1653 template< class Container, class EP = decltype( std::data(std::declval<Container&>())) >
1654 inline span_constexpr auto
1655 make_span( Container & cont ) span_noexcept -> span< typename std::remove_pointer<EP>::type >
1656 {
1658 }
1659 
1660 template< class Container, class EP = decltype( std::data(std::declval<Container&>())) >
1661 inline span_constexpr auto
1662 make_span( Container const & cont ) span_noexcept -> span< const typename std::remove_pointer<EP>::type >
1663 {
1665 }
1666 
1667 #elif span_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR ) && span_HAVE( AUTO )
1668 
1669 template< class Container, class EP = decltype( std17::data(std::declval<Container&>())) >
1670 inline span_constexpr auto
1671 make_span( Container & cont ) span_noexcept -> span< typename std::remove_pointer<EP>::type >
1672 {
1674 }
1675 
1676 template< class Container, class EP = decltype( std17::data(std::declval<Container&>())) >
1677 inline span_constexpr auto
1678 make_span( Container const & cont ) span_noexcept -> span< const typename std::remove_pointer<EP>::type >
1679 {
1681 }
1682 
1683 #else
1684 
1685 template< class T >
1686 inline span_constexpr span<T>
1687 make_span( span<T> spn ) span_noexcept
1688 {
1689  return spn;
1690 }
1691 
1692 template< class T, class Allocator >
1693 inline span_constexpr span<T>
1694 make_span( std::vector<T, Allocator> & cont ) span_noexcept
1695 {
1696  return span<T>( with_container, cont );
1697 }
1698 
1699 template< class T, class Allocator >
1701 make_span( std::vector<T, Allocator> const & cont ) span_noexcept
1702 {
1703  return span<const T>( with_container, cont );
1704 }
1705 
1706 #endif // span_USES_STD_SPAN || ( ... )
1707 
1708 #if ! span_USES_STD_SPAN && span_FEATURE( WITH_CONTAINER )
1709 
1710 template< class Container >
1712 make_span( with_container_t, Container & cont ) span_noexcept
1713 {
1715 }
1716 
1717 template< class Container >
1719 make_span( with_container_t, Container const & cont ) span_noexcept
1720 {
1722 }
1723 
1724 #endif // ! span_USES_STD_SPAN && span_FEATURE( WITH_CONTAINER )
1725 
1726 // extensions: non-member views:
1727 // this feature implies the presence of make_span()
1728 
1729 #if span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_SPAN )
1730 
1731 template< extent_t Count, class T, extent_t Extent >
1733 first( span<T, Extent> spn )
1734 {
1735  return spn.template first<Count>();
1736 }
1737 
1738 template< class T, extent_t Extent >
1740 first( span<T, Extent> spn, size_t count )
1741 {
1742  return spn.first( count );
1743 }
1744 
1745 template< extent_t Count, class T, extent_t Extent >
1747 last( span<T, Extent> spn )
1748 {
1749  return spn.template last<Count>();
1750 }
1751 
1752 template< class T, extent_t Extent >
1754 last( span<T, Extent> spn, size_t count )
1755 {
1756  return spn.last( count );
1757 }
1758 
1759 template< size_t Offset, extent_t Count, class T, extent_t Extent >
1761 subspan( span<T, Extent> spn )
1762 {
1763  return spn.template subspan<Offset, Count>();
1764 }
1765 
1766 template< class T, extent_t Extent >
1768 subspan( span<T, Extent> spn, size_t offset, extent_t count = dynamic_extent )
1769 {
1770  return spn.subspan( offset, count );
1771 }
1772 
1773 #endif // span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_SPAN )
1774 
1775 #if span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_CONTAINER ) && span_CPP11_120
1776 
1777 template< extent_t Count, class T >
1778 span_constexpr auto
1779 first( T & t ) -> decltype( make_span(t).template first<Count>() )
1780 {
1781  return make_span( t ).template first<Count>();
1782 }
1783 
1784 template< class T >
1785 span_constexpr auto
1786 first( T & t, size_t count ) -> decltype( make_span(t).first(count) )
1787 {
1788  return make_span( t ).first( count );
1789 }
1790 
1791 template< extent_t Count, class T >
1792 span_constexpr auto
1793 last( T & t ) -> decltype( make_span(t).template last<Count>() )
1794 {
1795  return make_span(t).template last<Count>();
1796 }
1797 
1798 template< class T >
1799 span_constexpr auto
1800 last( T & t, extent_t count ) -> decltype( make_span(t).last(count) )
1801 {
1802  return make_span( t ).last( count );
1803 }
1804 
1805 template< size_t Offset, extent_t Count = dynamic_extent, class T >
1806 span_constexpr auto
1807 subspan( T & t ) -> decltype( make_span(t).template subspan<Offset, Count>() )
1808 {
1809  return make_span( t ).template subspan<Offset, Count>();
1810 }
1811 
1812 template< class T >
1813 span_constexpr auto
1814 subspan( T & t, size_t offset, extent_t count = dynamic_extent ) -> decltype( make_span(t).subspan(offset, count) )
1815 {
1816  return make_span( t ).subspan( offset, count );
1817 }
1818 
1819 #endif // span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_CONTAINER )
1820 
1821 } // namespace span_lite
1822 } // namespace nonstd
1823 
1824 // make available in nonstd:
1825 
1826 namespace nonstd {
1827 using span_lite::make_span;
1828 
1829 #if span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_SPAN ) || ( span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_CONTAINER ) && span_CPP11_120 )
1830 
1831 using span_lite::first;
1832 using span_lite::last;
1833 using span_lite::subspan;
1834 
1835 #endif // span_FEATURE( NON_MEMBER_FIRST_LAST_SUB_[SPAN|CONTAINER] )
1836 
1837 } // namespace nonstd
1838 
1839 #endif // #if span_FEATURE_TO_STD( MAKE_SPAN )
1840 
1841 #if span_CPP11_OR_GREATER && span_FEATURE( BYTE_SPAN ) && ( span_HAVE( BYTE ) || span_HAVE( NONSTD_BYTE ) )
1842 
1843 namespace nonstd {
1844 namespace span_lite {
1845 
1846 template< class T >
1847 inline span_constexpr auto
1848 byte_span( T & t ) span_noexcept -> span< std17::byte, span_sizeof(T) >
1849 {
1850  return span< std17::byte, span_sizeof(t) >( reinterpret_cast< std17::byte * >( &t ), span_sizeof(T) );
1851 }
1852 
1853 template< class T >
1854 inline span_constexpr auto
1855 byte_span( T const & t ) span_noexcept -> span< const std17::byte, span_sizeof(T) >
1856 {
1857  return span< const std17::byte, span_sizeof(t) >( reinterpret_cast< std17::byte const * >( &t ), span_sizeof(T) );
1858 }
1859 
1860 } // namespace span_lite
1861 } // namespace nonstd
1862 
1863 // make available in nonstd:
1864 
1865 namespace nonstd {
1866 using span_lite::byte_span;
1867 } // namespace nonstd
1868 
1869 #endif // span_FEATURE( BYTE_SPAN )
1870 
1871 #if span_HAVE( STRUCT_BINDING )
1872 
1873 #if span_CPP14_OR_GREATER
1874 # include <tuple>
1875 #elif span_CPP11_OR_GREATER
1876 # include <tuple>
1877 namespace std {
1878  template< std::size_t I, typename T >
1879  using tuple_element_t = typename tuple_element<I, T>::type;
1880 }
1881 #else
1882 namespace std {
1883  template< typename T >
1884  class tuple_size; /*undefined*/
1885 
1886  template< std::size_t I, typename T >
1887  class tuple_element; /* undefined */
1888 }
1889 #endif // span_CPP14_OR_GREATER
1890 
1891 namespace std {
1892 
1893 // 26.7.X Tuple interface
1894 
1895 // std::tuple_size<>:
1896 
1897 template< typename ElementType, nonstd::span_lite::extent_t Extent >
1898 class tuple_size< nonstd::span<ElementType, Extent> > : public integral_constant<size_t, static_cast<size_t>(Extent)> {};
1899 
1900 // std::tuple_size<>: Leave undefined for dynamic extent:
1901 
1902 template< typename ElementType >
1903 class tuple_size< nonstd::span<ElementType, nonstd::dynamic_extent> >;
1904 
1905 // std::tuple_element<>:
1906 
1907 template< size_t I, typename ElementType, nonstd::span_lite::extent_t Extent >
1908 class tuple_element< I, nonstd::span<ElementType, Extent> >
1909 {
1910 public:
1911 #if span_HAVE( STATIC_ASSERT )
1912  static_assert( Extent != nonstd::dynamic_extent && I < Extent, "tuple_element<I,span>: dynamic extent or index out of range" );
1913 #endif
1914  using type = ElementType;
1915 };
1916 
1917 // std::get<>(), 2 variants:
1918 
1919 template< size_t I, typename ElementType, nonstd::span_lite::extent_t Extent >
1920 span_constexpr ElementType & get( nonstd::span<ElementType, Extent> & spn ) span_noexcept
1921 {
1922 #if span_HAVE( STATIC_ASSERT )
1923  static_assert( Extent != nonstd::dynamic_extent && I < Extent, "get<>(span): dynamic extent or index out of range" );
1924 #endif
1925  return spn[I];
1926 }
1927 
1928 template< size_t I, typename ElementType, nonstd::span_lite::extent_t Extent >
1929 span_constexpr ElementType const & get( nonstd::span<ElementType, Extent> const & spn ) span_noexcept
1930 {
1931 #if span_HAVE( STATIC_ASSERT )
1932  static_assert( Extent != nonstd::dynamic_extent && I < Extent, "get<>(span): dynamic extent or index out of range" );
1933 #endif
1934  return spn[I];
1935 }
1936 
1937 } // end namespace std
1938 
1939 #endif // span_HAVE( STRUCT_BINDING )
1940 
1941 #if ! span_USES_STD_SPAN
1943 #endif // span_USES_STD_SPAN
1944 
1945 #endif // NONSTD_SPAN_HPP_INCLUDED
std11::remove_volatile< typename std11::remove_const< T >::type >::type type
Definition: span-lite.hpp:598
void swap(any &x, any &y) any_noexcept
Definition: any-lite.hpp:614
span_constexpr_exp span< element_type, dynamic_extent > subspan(size_type offset, size_type count=static_cast< size_type >(dynamic_extent)) const
Definition: span-lite.hpp:1202
#define span_sizeof(T)
Definition: span-lite.hpp:868
span_constexpr_exp span(pointer first, pointer last)
Definition: span-lite.hpp:973
const_pointer const_iterator
Definition: span-lite.hpp:897
#define span_noreturn
Definition: span-lite.hpp:455
span_constexpr span(span const &other) span_noexcept
Definition: span-lite.hpp:1118
#define span_constexpr_exp
Definition: span-lite.hpp:506
span_constexpr_exp reference operator[](size_type idx) const
Definition: span-lite.hpp:1237
span_constexpr iterator begin() const span_noexcept
Definition: span-lite.hpp:1307
span_constexpr_exp span(span< OtherElementType, OtherExtent > const &other) span_noexcept
Definition: span-lite.hpp:1141
#define span_constexpr
Definition: span-lite.hpp:401
span_CONFIG_SIZE_TYPE size_t
Definition: span-lite.hpp:565
#define span_deprecated(msg)
Definition: span-lite.hpp:443
span_constexpr std::ptrdiff_t ssize(span< T, Extent > const &spn)
Definition: span-lite.hpp:1541
std::ptrdiff_t difference_type
Definition: span-lite.hpp:899
span_constexpr reverse_iterator rbegin() const span_noexcept
Definition: span-lite.hpp:1343
STL namespace.
span_constexpr_exp span< element_type, dynamic_extent > last(size_type count) const
Definition: span-lite.hpp:1194
span_constexpr size_type size_bytes() const span_noexcept
Definition: span-lite.hpp:1225
span_CONFIG_EXTENT_TYPE extent_t
Definition: span-lite.hpp:564
span_constexpr_exp span< element_type, Count > last() const
Definition: span-lite.hpp:1161
span_constexpr const_iterator cbegin() const span_noexcept
Definition: span-lite.hpp:1325
span_constexpr_exp span< element_type, Count > first() const
Definition: span-lite.hpp:1152
const span_constexpr with_container_t with_container
Definition: span-lite.hpp:575
span_constexpr span(element_type(&arr)[N]) span_noexcept
Definition: span-lite.hpp:989
#define span_REQUIRES_T(VA)
Definition: span-lite.hpp:553
#define span_nodiscard
Definition: span-lite.hpp:449
#define span_EXPECTS(cond)
Definition: span-lite.hpp:507
#define span_noexcept
Definition: span-lite.hpp:431
span_constexpr const_reverse_iterator crbegin() const span_noexcept
Definition: span-lite.hpp:1353
integral_constant< bool, false > false_type
Definition: span-lite.hpp:616
span_constexpr size_t to_size(T size)
Definition: span-lite.hpp:871
span_constexpr pointer data() const span_noexcept
Definition: span-lite.hpp:1270
span_noreturn void report_contract_violation(char const *) span_noexcept
Definition: span-lite.hpp:857
#define span_CONFIG_SIZE_TYPE
Definition: span-lite.hpp:54
span_constexpr_exp span< element_type, Count > subspan() const
Definition: span-lite.hpp:1174
integral_constant< bool, true > true_type
Definition: span-lite.hpp:615
span_constexpr_exp reference back() const span_noexcept
Definition: span-lite.hpp:1284
optional_constexpr bool operator>(optional< T > const &x, optional< U > const &y)
std11::remove_cv< T >::type value_type
Definition: span-lite.hpp:886
std::reverse_iterator< iterator > reverse_iterator
Definition: span-lite.hpp:901
span_constexpr bool is_positive(T x)
Definition: span-lite.hpp:714
span_constexpr_exp span(pointer ptr, size_type count)
Definition: span-lite.hpp:946
#define span_RESTORE_WARNINGS()
Definition: span-lite.hpp:312
bool operator!=(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)
span_constexpr with_container_t() span_noexcept
Definition: span-lite.hpp:574
span_constexpr_exp reference front() const span_noexcept
Definition: span-lite.hpp:1277
span_constexpr const extent_t dynamic_extent
Definition: span-lite.hpp:567
span_REQUIRES_0((Extent==0)||(Extent==dynamic_extent)) span_constexpr span() span_noexcept
Definition: span-lite.hpp:909
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: span-lite.hpp:902
span_constexpr const_iterator cend() const span_noexcept
Definition: span-lite.hpp:1334
#define span_ADDRESSOF(x)
Definition: span-lite.hpp:395
span_constexpr std::ptrdiff_t ssize() const span_noexcept
Definition: span-lite.hpp:1220
span_constexpr iterator end() const span_noexcept
Definition: span-lite.hpp:1316
span_constexpr size_type size() const span_noexcept
Definition: span-lite.hpp:1215
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span-lite.hpp:1535
span_nodiscard span_constexpr bool empty() const span_noexcept
Definition: span-lite.hpp:1230
span_constexpr reverse_iterator rend() const span_noexcept
Definition: span-lite.hpp:1348
~span() span_noexcept
Definition: span-lite.hpp:1123
#define span_constexpr14
Definition: span-lite.hpp:407
optional_constexpr bool operator>=(optional< T > const &x, optional< U > const &y)
span_constexpr const_reverse_iterator crend() const span_noexcept
Definition: span-lite.hpp:1358
#define span_nullptr
Definition: span-lite.hpp:437
#define span_CONFIG_EXTENT_TYPE
Definition: span-lite.hpp:50
span_constexpr_exp span< element_type, dynamic_extent > first(size_type count) const
Definition: span-lite.hpp:1186
bool operator==(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)
span_constexpr14 span & operator=(span const &other) span_noexcept
Definition: span-lite.hpp:1126