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


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:47