souffle  2.0.2-371-g6315b36
span.h
Go to the documentation of this file.
1 #pragma once
2 
3 #if __cplusplus >= 202000L
4 
5 #include <span> // use std lib impl
6 
7 namespace souffle {
8 constexpr auto dynamic_extent = std::dynamic_extent;
9 
10 template <typename A, size_t E = std::dynamic_extent>
11 using span = std::span<A, E>;
12 } // namespace souffle
13 
14 #else
15 
16 // clang-format off
17 /*
18 This is an implementation of C++20's std::span
19 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/n4820.pdf
20 */
21 
22 // Copyright Tristan Brindle 2018.
23 // Distributed under the Boost Software License, Version 1.0.
24 // (See accompanying file ../../LICENSE_1_0.txt or copy at
25 // https://www.boost.org/LICENSE_1_0.txt)
26 
27 #ifndef TCB_SPAN_HPP_INCLUDED
28 #define TCB_SPAN_HPP_INCLUDED
29 
30 #include <array>
31 #include <cstddef>
32 #include <cstdint>
33 #include <type_traits>
34 
35 #ifndef TCB_SPAN_NO_EXCEPTIONS
36 // Attempt to discover whether we're being compiled with exception support
37 #if !(defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND))
38 #define TCB_SPAN_NO_EXCEPTIONS
39 #endif
40 #endif
41 
42 #ifndef TCB_SPAN_NO_EXCEPTIONS
43 #include <cstdio>
44 #include <stdexcept>
45 #endif
46 
47 // Various feature test macros
48 
49 #ifndef TCB_SPAN_NAMESPACE_NAME
50 #define TCB_SPAN_NAMESPACE_NAME tcb
51 #endif
52 
53 #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
54 #define TCB_SPAN_HAVE_CPP17
55 #endif
56 
57 #if __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
58 #define TCB_SPAN_HAVE_CPP14
59 #endif
60 
62 
63 // Establish default contract checking behavior
64 #if !defined(TCB_SPAN_THROW_ON_CONTRACT_VIOLATION) && \
65  !defined(TCB_SPAN_TERMINATE_ON_CONTRACT_VIOLATION) && \
66  !defined(TCB_SPAN_NO_CONTRACT_CHECKING)
67 #if defined(NDEBUG) || !defined(TCB_SPAN_HAVE_CPP14)
68 #define TCB_SPAN_NO_CONTRACT_CHECKING
69 #else
70 #define TCB_SPAN_TERMINATE_ON_CONTRACT_VIOLATION
71 #endif
72 #endif
73 
74 #if defined(TCB_SPAN_THROW_ON_CONTRACT_VIOLATION)
75 struct contract_violation_error : std::logic_error {
76  explicit contract_violation_error(const char* msg) : std::logic_error(msg)
77  {}
78 };
79 
80 inline void contract_violation(const char* msg)
81 {
82  throw contract_violation_error(msg);
83 }
84 
85 #elif defined(TCB_SPAN_TERMINATE_ON_CONTRACT_VIOLATION)
86 [[noreturn]] inline void contract_violation(const char* /*unused*/)
87 {
88  std::terminate();
89 }
90 #endif
91 
92 #if !defined(TCB_SPAN_NO_CONTRACT_CHECKING)
93 #define TCB_SPAN_STRINGIFY(cond) #cond
94 #define TCB_SPAN_EXPECT(cond) \
95  cond ? (void) 0 : contract_violation("Expected " TCB_SPAN_STRINGIFY(cond))
96 #else
97 #define TCB_SPAN_EXPECT(cond)
98 #endif
99 
100 #if defined(TCB_SPAN_HAVE_CPP17) || defined(__cpp_inline_variables)
101 #define TCB_SPAN_INLINE_VAR inline
102 #else
103 #define TCB_SPAN_INLINE_VAR
104 #endif
105 
106 #if defined(TCB_SPAN_HAVE_CPP14) || \
107  (defined(__cpp_constexpr) && __cpp_constexpr >= 201304)
108 #define TCB_SPAN_HAVE_CPP14_CONSTEXPR
109 #endif
110 
111 #if defined(TCB_SPAN_HAVE_CPP14_CONSTEXPR)
112 #define TCB_SPAN_CONSTEXPR14 constexpr
113 #else
114 #define TCB_SPAN_CONSTEXPR14
115 #endif
116 
117 #if defined(TCB_SPAN_HAVE_CPP14_CONSTEXPR) && \
118  (!defined(_MSC_VER) || _MSC_VER > 1900)
119 #define TCB_SPAN_CONSTEXPR_ASSIGN constexpr
120 #else
121 #define TCB_SPAN_CONSTEXPR_ASSIGN
122 #endif
123 
124 #if defined(TCB_SPAN_NO_CONTRACT_CHECKING)
125 #define TCB_SPAN_CONSTEXPR11 constexpr
126 #else
127 #define TCB_SPAN_CONSTEXPR11 TCB_SPAN_CONSTEXPR14
128 #endif
129 
130 #if defined(TCB_SPAN_HAVE_CPP17) || defined(__cpp_deduction_guides)
131 #define TCB_SPAN_HAVE_DEDUCTION_GUIDES
132 #endif
133 
134 #if defined(TCB_SPAN_HAVE_CPP17) || defined(__cpp_lib_byte)
135 #define TCB_SPAN_HAVE_STD_BYTE
136 #endif
137 
138 #if defined(TCB_SPAN_HAVE_CPP17) || defined(__cpp_lib_array_constexpr)
139 #define TCB_SPAN_HAVE_CONSTEXPR_STD_ARRAY_ETC
140 #endif
141 
142 #if defined(TCB_SPAN_HAVE_CONSTEXPR_STD_ARRAY_ETC)
143 #define TCB_SPAN_ARRAY_CONSTEXPR constexpr
144 #else
145 #define TCB_SPAN_ARRAY_CONSTEXPR
146 #endif
147 
148 #ifdef TCB_SPAN_HAVE_STD_BYTE
149 using byte = std::byte;
150 #else
151 using byte = unsigned char;
152 #endif
153 
154 #if defined(TCB_SPAN_HAVE_CPP17)
155 #define TCB_SPAN_NODISCARD [[nodiscard]]
156 #else
157 #define TCB_SPAN_NODISCARD
158 #endif
159 
160 TCB_SPAN_INLINE_VAR constexpr std::size_t dynamic_extent = SIZE_MAX;
161 
162 template <typename ElementType, std::size_t Extent = dynamic_extent>
163 class span;
164 
165 namespace detail {
166 
167 template <typename E, std::size_t S>
168 struct span_storage {
169  constexpr span_storage() noexcept = default;
170 
171  constexpr span_storage(E* p_ptr, std::size_t /*unused*/) noexcept
172  : ptr(p_ptr)
173  {}
174 
175  E* ptr = nullptr;
176  static constexpr std::size_t size = S;
177 };
178 
179 template <typename E>
181  constexpr span_storage() noexcept = default;
182 
183  constexpr span_storage(E* p_ptr, std::size_t p_size) noexcept
184  : ptr(p_ptr), size(p_size)
185  {}
186 
187  E* ptr = nullptr;
188  std::size_t size = 0;
189 };
190 
191 // Reimplementation of C++17 std::size() and std::data()
192 #if defined(TCB_SPAN_HAVE_CPP17) || \
193  defined(__cpp_lib_nonmember_container_access)
194 using std::data;
195 using std::size;
196 #else
197 template <class C>
198 constexpr auto size(const C& c) -> decltype(c.size())
199 {
200  return c.size();
201 }
202 
203 template <class T, std::size_t N>
204 constexpr std::size_t size(const T (&)[N]) noexcept
205 {
206  return N;
207 }
208 
209 template <class C>
210 constexpr auto data(C& c) -> decltype(c.data())
211 {
212  return c.data();
213 }
214 
215 template <class C>
216 constexpr auto data(const C& c) -> decltype(c.data())
217 {
218  return c.data();
219 }
220 
221 template <class T, std::size_t N>
222 constexpr T* data(T (&array)[N]) noexcept
223 {
224  return array;
225 }
226 
227 template <class E>
228 constexpr const E* data(std::initializer_list<E> il) noexcept
229 {
230  return il.begin();
231 }
232 #endif // TCB_SPAN_HAVE_CPP17
233 
234 #if defined(TCB_SPAN_HAVE_CPP17) || defined(__cpp_lib_void_t)
235 using std::void_t;
236 #else
237 template <typename...>
238 using void_t = void;
239 #endif
240 
241 template <typename T>
242 using uncvref_t =
244 
245 template <typename>
246 struct is_span : std::false_type {};
247 
248 template <typename T, std::size_t S>
249 struct is_span<span<T, S>> : std::true_type {};
250 
251 template <typename>
252 struct is_std_array : std::false_type {};
253 
254 template <typename T, std::size_t N>
255 struct is_std_array<std::array<T, N>> : std::true_type {};
256 
257 template <typename, typename = void>
258 struct has_size_and_data : std::false_type {};
259 
260 template <typename T>
261 struct has_size_and_data<T, void_t<decltype(detail::size(std::declval<T>())),
262  decltype(detail::data(std::declval<T>()))>>
263  : std::true_type {};
264 
265 template <typename C, typename U = uncvref_t<C>>
266 struct is_container {
267  static constexpr bool value =
269  !std::is_array<U>::value && has_size_and_data<C>::value;
270 };
271 
272 template <typename T>
274 
275 template <typename, typename, typename = void>
276 struct is_container_element_type_compatible : std::false_type {};
277 
278 template <typename T, typename E>
280  T, E,
281  typename std::enable_if<
282  !std::is_same<typename std::remove_cv<decltype(
283  detail::data(std::declval<T>()))>::type,
284  void>::value>::type>
285  : std::is_convertible<
286  remove_pointer_t<decltype(detail::data(std::declval<T>()))> (*)[],
287  E (*)[]> {};
288 
289 template <typename, typename = size_t>
290 struct is_complete : std::false_type {};
291 
292 template <typename T>
293 struct is_complete<T, decltype(sizeof(T))> : std::true_type {};
294 
295 } // namespace detail
296 
297 template <typename ElementType, std::size_t Extent>
298 class span {
299  static_assert(std::is_object<ElementType>::value,
300  "A span's ElementType must be an object type (not a "
301  "reference type or void)");
303  "A span's ElementType must be a complete type (not a forward "
304  "declaration)");
305  static_assert(!std::is_abstract<ElementType>::value,
306  "A span's ElementType cannot be an abstract class type");
307 
309 
310 public:
311  // constants and types
312  using element_type = ElementType;
314  using size_type = std::size_t;
315  using difference_type = std::ptrdiff_t;
317  using const_pointer = const element_type*;
320  using iterator = pointer;
321  using reverse_iterator = std::reverse_iterator<iterator>;
322 
323  static constexpr size_type extent = Extent;
324 
325  // [span.cons], span constructors, copy, assignment, and destructor
326  template <
327  std::size_t E = Extent,
328  typename std::enable_if<(E == dynamic_extent || E <= 0), int>::type = 0>
329  constexpr span() noexcept // NOLINT : clang-tidy is mistaken. one cannot `default` a template ctor
330  {}
331 
333  : storage_(ptr, count)
334  {
336  }
337 
338  TCB_SPAN_CONSTEXPR11 span(pointer first_elem, pointer last_elem)
339  : storage_(first_elem, last_elem - first_elem)
340  {
342  last_elem - first_elem ==
343  static_cast<std::ptrdiff_t>(extent));
344  }
345 
346  template <std::size_t N, std::size_t E = Extent,
347  typename std::enable_if<
348  (E == dynamic_extent || N == E) &&
350  element_type (&)[N], ElementType>::value,
351  int>::type = 0>
352  constexpr span(element_type (&arr)[N]) noexcept : storage_(arr, N)
353  {}
354 
355  template <std::size_t N, std::size_t E = Extent,
356  typename std::enable_if<
357  (E == dynamic_extent || N == E) &&
359  std::array<value_type, N>&, ElementType>::value,
360  int>::type = 0>
361  TCB_SPAN_ARRAY_CONSTEXPR span(std::array<value_type, N>& arr) noexcept
362  : storage_(arr.data(), N)
363  {}
364 
365  template <std::size_t N, std::size_t E = Extent,
366  typename std::enable_if<
367  (E == dynamic_extent || N == E) &&
369  const std::array<value_type, N>&, ElementType>::value,
370  int>::type = 0>
371  TCB_SPAN_ARRAY_CONSTEXPR span(const std::array<value_type, N>& arr) noexcept
372  : storage_(arr.data(), N)
373  {}
374 
375  template <
376  typename Container, std::size_t E = Extent,
377  typename std::enable_if<
380  Container&, ElementType>::value,
381  int>::type = 0>
382  constexpr span(Container& cont)
383  : storage_(detail::data(cont), detail::size(cont))
384  {}
385 
386  template <
387  typename Container, std::size_t E = Extent,
388  typename std::enable_if<
391  const Container&, ElementType>::value,
392  int>::type = 0>
393  constexpr span(const Container& cont)
394  : storage_(detail::data(cont), detail::size(cont))
395  {}
396 
397  constexpr span(const span& other) noexcept = default;
398 
399  template <typename OtherElementType, std::size_t OtherExtent,
400  typename std::enable_if<
401  (Extent == OtherExtent || Extent == dynamic_extent) &&
402  std::is_convertible<OtherElementType (*)[],
403  ElementType (*)[]>::value,
404  int>::type = 0>
405  constexpr span(const span<OtherElementType, OtherExtent>& other) noexcept
406  : storage_(other.data(), other.size())
407  {}
408 
409  ~span() noexcept = default;
410 
412  operator=(const span& other) noexcept = default;
413 
414  // [span.sub], span subviews
415  template <std::size_t Count>
417  {
418  TCB_SPAN_EXPECT(Count <= size());
419  return {data(), Count};
420  }
421 
422  template <std::size_t Count>
424  {
425  TCB_SPAN_EXPECT(Count <= size());
426  return {data() + (size() - Count), Count};
427  }
428 
429  template <std::size_t Offset, std::size_t Count = dynamic_extent>
430  using subspan_return_t =
431  span<ElementType, Count != dynamic_extent
432  ? Count
433  : (Extent != dynamic_extent ? Extent - Offset
435 
436  template <std::size_t Offset, std::size_t Count = dynamic_extent>
438  {
439  TCB_SPAN_EXPECT(Offset <= size() &&
440  (Count == dynamic_extent || Offset + Count <= size()));
441  return {data() + Offset,
442  Count != dynamic_extent ? Count : size() - Offset};
443  }
444 
447  {
448  TCB_SPAN_EXPECT(count <= size());
449  return {data(), count};
450  }
451 
454  {
455  TCB_SPAN_EXPECT(count <= size());
456  return {data() + (size() - count), count};
457  }
458 
461  {
462  TCB_SPAN_EXPECT(offset <= size() &&
463  (count == dynamic_extent || offset + count <= size()));
464  return {data() + offset,
465  count == dynamic_extent ? size() - offset : count};
466  }
467 
468  // [span.obs], span observers
469  constexpr size_type size() const noexcept { return storage_.size; }
470 
471  constexpr size_type size_bytes() const noexcept
472  {
473  return size() * sizeof(element_type);
474  }
475 
476  TCB_SPAN_NODISCARD constexpr bool empty() const noexcept
477  {
478  return size() == 0;
479  }
480 
481  // [span.elem], span element access
483  {
484  TCB_SPAN_EXPECT(idx < size());
485  return *(data() + idx);
486  }
487 
489  {
491  return *data();
492  }
493 
495  {
497  return *(data() + (size() - 1));
498  }
499 
500  constexpr pointer data() const noexcept { return storage_.ptr; }
501 
502  // [span.iterators], span iterator support
503  constexpr iterator begin() const noexcept { return data(); }
504 
505  constexpr iterator end() const noexcept { return data() + size(); }
506 
508  {
509  return reverse_iterator(end());
510  }
511 
513  {
514  return reverse_iterator(begin());
515  }
516 
517 private:
519 };
520 
521 #ifdef TCB_SPAN_HAVE_DEDUCTION_GUIDES
522 
523 /* Deduction Guides */
524 template <class T, size_t N>
525 span(T (&)[N])->span<T, N>;
526 
527 template <class T, size_t N>
528 span(std::array<T, N>&)->span<T, N>;
529 
530 template <class T, size_t N>
531 span(const std::array<T, N>&)->span<const T, N>;
532 
533 template <class Container>
534 span(Container&)->span<typename Container::value_type>;
535 
536 template <class Container>
537 span(const Container&)->span<const typename Container::value_type>;
538 
539 #endif // TCB_HAVE_DEDUCTION_GUIDES
540 
541 template <typename ElementType, std::size_t Extent>
542 constexpr span<ElementType, Extent>
544 {
545  return s;
546 }
547 
548 template <typename T, std::size_t N>
549 constexpr span<T, N> make_span(T (&arr)[N]) noexcept
550 {
551  return {arr};
552 }
553 
554 template <typename T, std::size_t N>
555 TCB_SPAN_ARRAY_CONSTEXPR span<T, N> make_span(std::array<T, N>& arr) noexcept
556 {
557  return {arr};
558 }
559 
560 template <typename T, std::size_t N>
561 TCB_SPAN_ARRAY_CONSTEXPR span<const T, N>
562 make_span(const std::array<T, N>& arr) noexcept
563 {
564  return {arr};
565 }
566 
567 template <typename Container>
569 {
570  return {cont};
571 }
572 
573 template <typename Container>
574 constexpr span<const typename Container::value_type>
575 make_span(const Container& cont)
576 {
577  return {cont};
578 }
579 
580 template <typename ElementType, std::size_t Extent>
582  : sizeof(ElementType) * Extent)>
584 {
585  return {reinterpret_cast<const byte*>(s.data()), s.size_bytes()};
586 }
587 
588 template <
589  class ElementType, size_t Extent,
590  typename std::enable_if<!std::is_const<ElementType>::value, int>::type = 0>
592  : sizeof(ElementType) * Extent)>
594 {
595  return {reinterpret_cast<byte*>(s.data()), s.size_bytes()};
596 }
597 
598 template <std::size_t N, typename E, std::size_t S>
599 constexpr auto get(span<E, S> s) -> decltype(s[N])
600 {
601  return s[N];
602 }
603 
604 } // namespace TCB_SPAN_NAMESPACE_NAME
605 
606 namespace std {
607 
608 // see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82716
609 // libc++: https://reviews.llvm.org/D55466#1325498
610 // `libc++` changed to use `struct`
611 // spec: http://eel.is/c++draft/tuple.helper
612 // Spec says to use `struct`.
613 // MSVC: Has different ABI for `class`/`struct`.
614 // Defined `tuple_size` as `class`.
615 #if defined(_MSC_VER)
616  #define TCB_SPAN_TUPLE_SIZE_KIND class
617 #else
618  #define TCB_SPAN_TUPLE_SIZE_KIND struct
619 #endif
620 
621 #if defined(__clang__)
622  #pragma clang diagnostic push
623  #pragma clang diagnostic ignored "-Wmismatched-tags"
624 #endif
625 
626 template <typename ElementType, size_t Extent>
627 TCB_SPAN_TUPLE_SIZE_KIND tuple_size<TCB_SPAN_NAMESPACE_NAME::span<ElementType, Extent>>
628  : public integral_constant<size_t, Extent> {};
629 
630 template <typename ElementType>
632  ElementType, TCB_SPAN_NAMESPACE_NAME::dynamic_extent>>; // not defined
633 
634 template <size_t I, typename ElementType, size_t Extent>
635 TCB_SPAN_TUPLE_SIZE_KIND tuple_element<I, TCB_SPAN_NAMESPACE_NAME::span<ElementType, Extent>> {
636 public:
638  I < Extent,
639  "");
640  using type = ElementType;
641 };
642 
643 #if defined(__clang__)
644  #pragma clang diagnostic pop
645 #endif
646 
647 #undef TCB_SPAN_TUPLE_SIZE_KIND
648 
649 } // end namespace std
650 
651 #endif // TCB_SPAN_HPP_INCLUDED
652 
653 // clang-format on
654 
655 namespace souffle {
657 
658 template <typename A, size_t E = tcb::dynamic_extent>
659 using span = tcb::span<A, E>;
660 } // namespace souffle
661 
662 #endif
TCB_SPAN_NAMESPACE_NAME::span::reference
element_type & reference
Definition: span.h:318
TCB_SPAN_NAMESPACE_NAME::detail::span_storage::size
static constexpr std::size_t size
Definition: span.h:176
TCB_SPAN_NAMESPACE_NAME::detail::size
constexpr auto size(const C &c) -> decltype(c.size())
Definition: span.h:198
TCB_SPAN_NAMESPACE_NAME::span::operator[]
TCB_SPAN_CONSTEXPR11 reference operator[](size_type idx) const
Definition: span.h:482
TCB_SPAN_NAMESPACE_NAME::dynamic_extent
constexpr TCB_SPAN_INLINE_VAR std::size_t dynamic_extent
Definition: span.h:160
TCB_SPAN_NAMESPACE_NAME::span
Definition: span.h:163
TCB_SPAN_NAMESPACE_NAME::span::subspan
TCB_SPAN_CONSTEXPR11 span< element_type, dynamic_extent > subspan(size_type offset, size_type count=dynamic_extent) const
Definition: span.h:460
TCB_SPAN_NAMESPACE_NAME::span::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition: span.h:321
TCB_SPAN_NAMESPACE_NAME::detail::remove_pointer_t
typename std::remove_pointer< T >::type remove_pointer_t
Definition: span.h:273
souffle::dynamic_extent
constexpr auto dynamic_extent
Definition: span.h:656
souffle::span
tcb::span< A, E > span
Definition: span.h:659
TCB_SPAN_NAMESPACE_NAME::span::difference_type
std::ptrdiff_t difference_type
Definition: span.h:315
TCB_SPAN_NAMESPACE_NAME::as_bytes
span< const byte,((Extent==dynamic_extent) ? dynamic_extent :sizeof(ElementType) *Extent)> as_bytes(span< ElementType, Extent > s) noexcept
Definition: span.h:583
TCB_SPAN_NAMESPACE_NAME::detail::is_container
Definition: span.h:266
TCB_SPAN_NAMESPACE_NAME::detail::uncvref_t
typename std::remove_cv< typename std::remove_reference< T >::type >::type uncvref_t
Definition: span.h:243
TCB_SPAN_NAMESPACE_NAME::detail::span_storage::span_storage
constexpr span_storage(E *p_ptr, std::size_t) noexcept
Definition: span.h:171
TCB_SPAN_NAMESPACE_NAME::span::pointer
element_type * pointer
Definition: span.h:316
TCB_SPAN_INLINE_VAR
#define TCB_SPAN_INLINE_VAR
Definition: span.h:103
TCB_SPAN_NAMESPACE_NAME::span::last
TCB_SPAN_CONSTEXPR11 span< element_type, dynamic_extent > last(size_type count) const
Definition: span.h:453
S
#define S(x)
Definition: test.h:179
TCB_SPAN_NAMESPACE_NAME::span::rend
TCB_SPAN_ARRAY_CONSTEXPR reverse_iterator rend() const noexcept
Definition: span.h:512
TCB_SPAN_NAMESPACE_NAME::span::span
constexpr span(const Container &cont)
Definition: span.h:393
TCB_SPAN_NAMESPACE_NAME::detail::span_storage::span_storage
constexpr span_storage() noexcept=default
TCB_SPAN_NAMESPACE_NAME::span::storage_
storage_type storage_
Definition: span.h:518
TCB_SPAN_NAMESPACE_NAME::detail::span_storage::ptr
E * ptr
Definition: span.h:175
TCB_SPAN_NAMESPACE_NAME::span::span
TCB_SPAN_CONSTEXPR11 span(pointer first_elem, pointer last_elem)
Definition: span.h:338
TCB_SPAN_NODISCARD
#define TCB_SPAN_NODISCARD
Definition: span.h:157
TCB_SPAN_NAMESPACE_NAME::span::size
constexpr size_type size() const noexcept
Definition: span.h:469
TCB_SPAN_NAMESPACE_NAME::span::span
TCB_SPAN_CONSTEXPR11 span(pointer ptr, size_type count)
Definition: span.h:332
TCB_SPAN_NAMESPACE_NAME::span::first
TCB_SPAN_CONSTEXPR11 span< element_type, Count > first() const
Definition: span.h:416
TCB_SPAN_NAMESPACE_NAME::span::~span
~span() noexcept=default
TCB_SPAN_TUPLE_SIZE_KIND
#define TCB_SPAN_TUPLE_SIZE_KIND
Definition: span.h:618
TCB_SPAN_NAMESPACE_NAME
Definition: span.h:61
TCB_SPAN_CONSTEXPR_ASSIGN
#define TCB_SPAN_CONSTEXPR_ASSIGN
Definition: span.h:121
array
TCB_SPAN_NAMESPACE_NAME::span::const_reference
const element_type & const_reference
Definition: span.h:319
TCB_SPAN_NAMESPACE_NAME::detail::size
constexpr std::size_t size(const T(&)[N]) noexcept
Definition: span.h:204
TCB_SPAN_NAMESPACE_NAME::span::span
TCB_SPAN_ARRAY_CONSTEXPR span(const std::array< value_type, N > &arr) noexcept
Definition: span.h:371
TCB_SPAN_NAMESPACE_NAME::span::begin
constexpr iterator begin() const noexcept
Definition: span.h:503
TCB_SPAN_NAMESPACE_NAME::span::size_bytes
constexpr size_type size_bytes() const noexcept
Definition: span.h:471
TCB_SPAN_NAMESPACE_NAME::span::front
TCB_SPAN_CONSTEXPR11 reference front() const
Definition: span.h:488
TCB_SPAN_NAMESPACE_NAME::span::rbegin
TCB_SPAN_ARRAY_CONSTEXPR reverse_iterator rbegin() const noexcept
Definition: span.h:507
TCB_SPAN_CONSTEXPR11
#define TCB_SPAN_CONSTEXPR11
Definition: span.h:125
std::Extent
TCB_SPAN_TUPLE_SIZE_KIND Extent
Definition: span.h:628
TCB_SPAN_NAMESPACE_NAME::detail::is_container_element_type_compatible
Definition: span.h:276
TCB_SPAN_NAMESPACE_NAME::as_writable_bytes
span< byte,((Extent==dynamic_extent) ? dynamic_extent :sizeof(ElementType) *Extent)> as_writable_bytes(span< ElementType, Extent > s) noexcept
Definition: span.h:593
TCB_SPAN_NAMESPACE_NAME::detail::data
constexpr const E * data(std::initializer_list< E > il) noexcept
Definition: span.h:228
TCB_SPAN_NAMESPACE_NAME::detail::is_complete
Definition: span.h:290
souffle::test::count
int count(const C &c)
Definition: table_test.cpp:40
TCB_SPAN_NAMESPACE_NAME::get
constexpr auto get(span< E, S > s) -> decltype(s[N])
Definition: span.h:599
TCB_SPAN_NAMESPACE_NAME::span::first
TCB_SPAN_CONSTEXPR11 span< element_type, dynamic_extent > first(size_type count) const
Definition: span.h:446
TCB_SPAN_NAMESPACE_NAME::detail::has_size_and_data
Definition: span.h:258
TCB_SPAN_NAMESPACE_NAME::detail::is_container::value
static constexpr bool value
Definition: span.h:267
TCB_SPAN_NAMESPACE_NAME::span::element_type
ElementType element_type
Definition: span.h:312
TCB_SPAN_NAMESPACE_NAME::span::value_type
typename std::remove_cv< ElementType >::type value_type
Definition: span.h:313
TCB_SPAN_NAMESPACE_NAME::span::end
constexpr iterator end() const noexcept
Definition: span.h:505
TCB_SPAN_NAMESPACE_NAME::span::span
constexpr span(const span< OtherElementType, OtherExtent > &other) noexcept
Definition: span.h:405
TCB_SPAN_NAMESPACE_NAME::span::span
constexpr span(element_type(&arr)[N]) noexcept
Definition: span.h:352
TCB_SPAN_NAMESPACE_NAME::span::const_pointer
const element_type * const_pointer
Definition: span.h:317
TCB_SPAN_NAMESPACE_NAME::span::empty
constexpr TCB_SPAN_NODISCARD bool empty() const noexcept
Definition: span.h:476
std
Definition: Brie.h:3053
TCB_SPAN_NAMESPACE_NAME::byte
unsigned char byte
Definition: span.h:151
TCB_SPAN_NAMESPACE_NAME::detail::span_storage< E, dynamic_extent >::span_storage
constexpr span_storage(E *p_ptr, std::size_t p_size) noexcept
Definition: span.h:183
TCB_SPAN_NAMESPACE_NAME::detail::is_std_array
Definition: span.h:252
TCB_SPAN_NAMESPACE_NAME::make_span
constexpr span< ElementType, Extent > make_span(span< ElementType, Extent > s) noexcept
Definition: span.h:543
souffle
Definition: AggregateOp.h:25
TCB_SPAN_NAMESPACE_NAME::detail::data
constexpr auto data(C &c) -> decltype(c.data())
Definition: span.h:210
TCB_SPAN_NAMESPACE_NAME::detail::void_t
void void_t
Definition: span.h:238
TCB_SPAN_ARRAY_CONSTEXPR
#define TCB_SPAN_ARRAY_CONSTEXPR
Definition: span.h:145
TCB_SPAN_NAMESPACE_NAME::span::span
TCB_SPAN_ARRAY_CONSTEXPR span(std::array< value_type, N > &arr) noexcept
Definition: span.h:361
TCB_SPAN_NAMESPACE_NAME::span::back
TCB_SPAN_CONSTEXPR11 reference back() const
Definition: span.h:494
TCB_SPAN_NAMESPACE_NAME::span::subspan
TCB_SPAN_CONSTEXPR11 subspan_return_t< Offset, Count > subspan() const
Definition: span.h:437
TCB_SPAN_NAMESPACE_NAME::detail::span_storage
Definition: span.h:168
TCB_SPAN_NAMESPACE_NAME::span::subspan_return_t
span< ElementType, Count !=dynamic_extent ? Count :(Extent !=dynamic_extent ? Extent - Offset :dynamic_extent)> subspan_return_t
Definition: span.h:434
TCB_SPAN_NAMESPACE_NAME::span::last
TCB_SPAN_CONSTEXPR11 span< element_type, Count > last() const
Definition: span.h:423
TCB_SPAN_NAMESPACE_NAME::span::size_type
std::size_t size_type
Definition: span.h:314
TCB_SPAN_NAMESPACE_NAME::span::span
constexpr span() noexcept
Definition: span.h:329
TCB_SPAN_NAMESPACE_NAME::span::span
constexpr span(Container &cont)
Definition: span.h:382
TCB_SPAN_EXPECT
#define TCB_SPAN_EXPECT(cond)
Definition: span.h:97
std::type
ElementType type
Definition: span.h:640
TCB_SPAN_NAMESPACE_NAME::detail::is_span
Definition: span.h:246
TCB_SPAN_NAMESPACE_NAME::span::data
constexpr pointer data() const noexcept
Definition: span.h:500
TCB_SPAN_NAMESPACE_NAME::span::extent
static constexpr size_type extent
Definition: span.h:323
TCB_SPAN_NAMESPACE_NAME::span::iterator
pointer iterator
Definition: span.h:320