/src/jsoncons/include/jsoncons/detail/span.hpp
Line | Count | Source |
1 | | // Copyright 2013-2026 Daniel Parker |
2 | | // Distributed under the Boost license, Version 1.0. |
3 | | // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
4 | | |
5 | | // See https://github.com/danielaparker/jsoncons for latest version |
6 | | |
7 | | #ifndef JSONCONS_DETAIL_SPAN_HPP |
8 | | #define JSONCONS_DETAIL_SPAN_HPP |
9 | | |
10 | | #include <array> |
11 | | #include <cstddef> |
12 | | #include <iterator> |
13 | | #include <limits> |
14 | | #include <memory> // std::addressof |
15 | | #include <type_traits> // std::enable_if, std::true_type, std::false_type |
16 | | |
17 | | #include <jsoncons/utility/more_type_traits.hpp> |
18 | | |
19 | | namespace jsoncons { |
20 | | namespace detail { |
21 | | |
22 | | constexpr std::size_t dynamic_extent = (std::numeric_limits<std::size_t>::max)(); |
23 | | |
24 | | template< typename T, std::size_t Extent = dynamic_extent> |
25 | | class span; |
26 | | |
27 | | template <typename T> |
28 | | struct is_span : std::false_type{}; |
29 | | |
30 | | template< typename T> |
31 | | struct is_span<span<T>> : std::true_type{}; |
32 | | |
33 | | template< |
34 | | typename T, |
35 | | std::size_t Extent |
36 | | > class span |
37 | | { |
38 | | public: |
39 | | using element_type = T; |
40 | | using value_type = typename std::remove_const<T>::type; |
41 | | using size_type = std::size_t; |
42 | | using difference_type = std::ptrdiff_t; |
43 | | using pointer = T*; |
44 | | using const_pointer = const T*; |
45 | | using reference = T&; |
46 | | using const_reference = const T&; |
47 | | using iterator = pointer; |
48 | | using const_iterator = const_pointer; |
49 | | using reverse_iterator = std::reverse_iterator<iterator>; |
50 | | using const_reverse_iterator = std::reverse_iterator<const_iterator>; |
51 | | private: |
52 | | pointer data_{nullptr}; |
53 | | size_type size_{0}; |
54 | | public: |
55 | | static constexpr std::size_t extent = Extent; |
56 | | |
57 | | constexpr span() noexcept |
58 | 25.6M | { |
59 | 25.6M | } jsoncons::detail::span<char const, 18446744073709551615ul>::span() Line | Count | Source | 58 | 27.4k | { | 59 | 27.4k | } |
jsoncons::detail::span<unsigned char const, 18446744073709551615ul>::span() Line | Count | Source | 58 | 25.5M | { | 59 | 25.5M | } |
Unexecuted instantiation: jsoncons::detail::span<unsigned char, 18446744073709551615ul>::span() Unexecuted instantiation: jsoncons::detail::span<unsigned long const, 18446744073709551615ul>::span() |
60 | | constexpr span(pointer data, size_type size) |
61 | 18.1M | : data_(data), size_(size) |
62 | 18.1M | { |
63 | 18.1M | } jsoncons::detail::span<unsigned char const, 18446744073709551615ul>::span(unsigned char const*, unsigned long) Line | Count | Source | 61 | 17.6M | : data_(data), size_(size) | 62 | 17.6M | { | 63 | 17.6M | } |
jsoncons::detail::span<char const, 18446744073709551615ul>::span(char const*, unsigned long) Line | Count | Source | 61 | 57.7k | : data_(data), size_(size) | 62 | 57.7k | { | 63 | 57.7k | } |
Unexecuted instantiation: jsoncons::detail::span<unsigned long const, 18446744073709551615ul>::span(unsigned long const*, unsigned long) jsoncons::detail::span<unsigned short, 18446744073709551615ul>::span(unsigned short*, unsigned long) Line | Count | Source | 61 | 164k | : data_(data), size_(size) | 62 | 164k | { | 63 | 164k | } |
jsoncons::detail::span<unsigned int, 18446744073709551615ul>::span(unsigned int*, unsigned long) Line | Count | Source | 61 | 23.2k | : data_(data), size_(size) | 62 | 23.2k | { | 63 | 23.2k | } |
jsoncons::detail::span<unsigned long, 18446744073709551615ul>::span(unsigned long*, unsigned long) Line | Count | Source | 61 | 64.6k | : data_(data), size_(size) | 62 | 64.6k | { | 63 | 64.6k | } |
jsoncons::detail::span<signed char, 18446744073709551615ul>::span(signed char*, unsigned long) Line | Count | Source | 61 | 15.7k | : data_(data), size_(size) | 62 | 15.7k | { | 63 | 15.7k | } |
jsoncons::detail::span<short, 18446744073709551615ul>::span(short*, unsigned long) Line | Count | Source | 61 | 51.1k | : data_(data), size_(size) | 62 | 51.1k | { | 63 | 51.1k | } |
jsoncons::detail::span<int, 18446744073709551615ul>::span(int*, unsigned long) Line | Count | Source | 61 | 25.1k | : data_(data), size_(size) | 62 | 25.1k | { | 63 | 25.1k | } |
jsoncons::detail::span<long, 18446744073709551615ul>::span(long*, unsigned long) Line | Count | Source | 61 | 30.5k | : data_(data), size_(size) | 62 | 30.5k | { | 63 | 30.5k | } |
jsoncons::detail::span<float, 18446744073709551615ul>::span(float*, unsigned long) Line | Count | Source | 61 | 43.7k | : data_(data), size_(size) | 62 | 43.7k | { | 63 | 43.7k | } |
jsoncons::detail::span<double, 18446744073709551615ul>::span(double*, unsigned long) Line | Count | Source | 61 | 21.2k | : data_(data), size_(size) | 62 | 21.2k | { | 63 | 21.2k | } |
|
64 | | |
65 | | template <typename C> |
66 | | constexpr span(C& c, |
67 | | typename std::enable_if<!is_span<C>::value && !ext_traits::is_std_array<C>::value && ext_traits::is_compatible_element<C,element_type>::value && ext_traits::has_data_and_size<C>::value>::type* = 0) |
68 | 476k | : data_(c.data()), size_(c.size()) |
69 | 476k | { |
70 | 476k | } _ZN8jsoncons6detail4spanIhLm18446744073709551615EEC2INSt3__16vectorIhNS4_9allocatorIhEEEEEERT_PNS4_9enable_ifIXaaaaaantsr7is_spanIS9_EE5valuentsr10ext_traits12is_std_arrayIS9_EE5valuesr10ext_traits21is_compatible_elementIS9_hEE5valuesr10ext_traits17has_data_and_sizeIS9_EE5valueEvE4typeE Line | Count | Source | 68 | 464k | : data_(c.data()), size_(c.size()) | 69 | 464k | { | 70 | 464k | } |
_ZN8jsoncons6detail4spanIKmLm18446744073709551615EEC2INSt3__16vectorImNS5_9allocatorImEEEEEERT_PNS5_9enable_ifIXaaaaaantsr7is_spanISA_EE5valuentsr10ext_traits12is_std_arrayISA_EE5valuesr10ext_traits21is_compatible_elementISA_S2_EE5valuesr10ext_traits17has_data_and_sizeISA_EE5valueEvE4typeE Line | Count | Source | 68 | 12.4k | : data_(c.data()), size_(c.size()) | 69 | 12.4k | { | 70 | 12.4k | } |
|
71 | | |
72 | | template <std::size_t N> |
73 | | span(element_type (&arr)[N]) noexcept |
74 | | : data_(std::addressof(arr[0])), size_(N) |
75 | | { |
76 | | } |
77 | | |
78 | | template <std::size_t N> |
79 | | span(std::array<value_type, N>& arr, |
80 | | typename std::enable_if<(extent == dynamic_extent || extent == N)>::type* = 0) noexcept |
81 | | : data_(arr.data()), size_(arr.size()) |
82 | | { |
83 | | } |
84 | | |
85 | | template <std::size_t N> |
86 | | span(const std::array<value_type, N>& arr, |
87 | | typename std::enable_if<(extent == dynamic_extent || extent == N)>::type* = 0) noexcept |
88 | | : data_(arr.data()), size_(arr.size()) |
89 | | { |
90 | | } |
91 | | |
92 | | template <typename C> |
93 | | constexpr span(const C& c, |
94 | | typename std::enable_if<!is_span<C>::value && !ext_traits::is_std_array<C>::value && ext_traits::is_compatible_element<C,element_type>::value && ext_traits::has_data_and_size<C>::value>::type* = 0) |
95 | | : data_(c.data()), size_(c.size()) |
96 | | { |
97 | | } |
98 | | |
99 | | template <typename U, std::size_t N> |
100 | | constexpr span(const span<U, N>& s, |
101 | | typename std::enable_if<(N == dynamic_extent || N == extent) && std::is_convertible<U(*)[], element_type(*)[]>::value>::type* = 0) noexcept |
102 | 232k | : data_(s.data()), size_(s.size()) |
103 | 232k | { |
104 | 232k | } _ZN8jsoncons6detail4spanIKhLm18446744073709551615EEC2IhLm18446744073709551615EEERKNS1_IT_XT0_EEEPNSt3__19enable_ifIXaaooeqT0_L_ZNS0_L14dynamic_extentEEeqT0_L_ZNS3_6extentEEsr3std14is_convertibleIPA_S5_PA_S2_EE5valueEvE4typeE Line | Count | Source | 102 | 12.0k | : data_(s.data()), size_(s.size()) | 103 | 12.0k | { | 104 | 12.0k | } |
_ZN8jsoncons6detail4spanIKtLm18446744073709551615EEC2ItLm18446744073709551615EEERKNS1_IT_XT0_EEEPNSt3__19enable_ifIXaaooeqT0_L_ZNS0_L14dynamic_extentEEeqT0_L_ZNS3_6extentEEsr3std14is_convertibleIPA_S5_PA_S2_EE5valueEvE4typeE Line | Count | Source | 102 | 82.3k | : data_(s.data()), size_(s.size()) | 103 | 82.3k | { | 104 | 82.3k | } |
_ZN8jsoncons6detail4spanIKjLm18446744073709551615EEC2IjLm18446744073709551615EEERKNS1_IT_XT0_EEEPNSt3__19enable_ifIXaaooeqT0_L_ZNS0_L14dynamic_extentEEeqT0_L_ZNS3_6extentEEsr3std14is_convertibleIPA_S5_PA_S2_EE5valueEvE4typeE Line | Count | Source | 102 | 11.6k | : data_(s.data()), size_(s.size()) | 103 | 11.6k | { | 104 | 11.6k | } |
_ZN8jsoncons6detail4spanIKmLm18446744073709551615EEC2ImLm18446744073709551615EEERKNS1_IT_XT0_EEEPNSt3__19enable_ifIXaaooeqT0_L_ZNS0_L14dynamic_extentEEeqT0_L_ZNS3_6extentEEsr3std14is_convertibleIPA_S5_PA_S2_EE5valueEvE4typeE Line | Count | Source | 102 | 32.3k | : data_(s.data()), size_(s.size()) | 103 | 32.3k | { | 104 | 32.3k | } |
_ZN8jsoncons6detail4spanIKaLm18446744073709551615EEC2IaLm18446744073709551615EEERKNS1_IT_XT0_EEEPNSt3__19enable_ifIXaaooeqT0_L_ZNS0_L14dynamic_extentEEeqT0_L_ZNS3_6extentEEsr3std14is_convertibleIPA_S5_PA_S2_EE5valueEvE4typeE Line | Count | Source | 102 | 7.88k | : data_(s.data()), size_(s.size()) | 103 | 7.88k | { | 104 | 7.88k | } |
_ZN8jsoncons6detail4spanIKsLm18446744073709551615EEC2IsLm18446744073709551615EEERKNS1_IT_XT0_EEEPNSt3__19enable_ifIXaaooeqT0_L_ZNS0_L14dynamic_extentEEeqT0_L_ZNS3_6extentEEsr3std14is_convertibleIPA_S5_PA_S2_EE5valueEvE4typeE Line | Count | Source | 102 | 25.5k | : data_(s.data()), size_(s.size()) | 103 | 25.5k | { | 104 | 25.5k | } |
_ZN8jsoncons6detail4spanIKiLm18446744073709551615EEC2IiLm18446744073709551615EEERKNS1_IT_XT0_EEEPNSt3__19enable_ifIXaaooeqT0_L_ZNS0_L14dynamic_extentEEeqT0_L_ZNS3_6extentEEsr3std14is_convertibleIPA_S5_PA_S2_EE5valueEvE4typeE Line | Count | Source | 102 | 12.5k | : data_(s.data()), size_(s.size()) | 103 | 12.5k | { | 104 | 12.5k | } |
_ZN8jsoncons6detail4spanIKlLm18446744073709551615EEC2IlLm18446744073709551615EEERKNS1_IT_XT0_EEEPNSt3__19enable_ifIXaaooeqT0_L_ZNS0_L14dynamic_extentEEeqT0_L_ZNS3_6extentEEsr3std14is_convertibleIPA_S5_PA_S2_EE5valueEvE4typeE Line | Count | Source | 102 | 15.2k | : data_(s.data()), size_(s.size()) | 103 | 15.2k | { | 104 | 15.2k | } |
_ZN8jsoncons6detail4spanIKfLm18446744073709551615EEC2IfLm18446744073709551615EEERKNS1_IT_XT0_EEEPNSt3__19enable_ifIXaaooeqT0_L_ZNS0_L14dynamic_extentEEeqT0_L_ZNS3_6extentEEsr3std14is_convertibleIPA_S5_PA_S2_EE5valueEvE4typeE Line | Count | Source | 102 | 21.8k | : data_(s.data()), size_(s.size()) | 103 | 21.8k | { | 104 | 21.8k | } |
_ZN8jsoncons6detail4spanIKdLm18446744073709551615EEC2IdLm18446744073709551615EEERKNS1_IT_XT0_EEEPNSt3__19enable_ifIXaaooeqT0_L_ZNS0_L14dynamic_extentEEeqT0_L_ZNS3_6extentEEsr3std14is_convertibleIPA_S5_PA_S2_EE5valueEvE4typeE Line | Count | Source | 102 | 10.6k | : data_(s.data()), size_(s.size()) | 103 | 10.6k | { | 104 | 10.6k | } |
|
105 | | |
106 | | constexpr span(const span& other) = default; |
107 | | |
108 | | span& operator=( const span& other ) = default; |
109 | | |
110 | | constexpr pointer data() const noexcept |
111 | 53.1M | { |
112 | 53.1M | return data_; |
113 | 53.1M | } jsoncons::detail::span<unsigned char const, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 52.4M | { | 112 | 52.4M | return data_; | 113 | 52.4M | } |
jsoncons::detail::span<char const, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 57.6k | { | 112 | 57.6k | return data_; | 113 | 57.6k | } |
Unexecuted instantiation: jsoncons::detail::span<unsigned short const, 18446744073709551615ul>::data() const Unexecuted instantiation: jsoncons::detail::span<unsigned int const, 18446744073709551615ul>::data() const Unexecuted instantiation: jsoncons::detail::span<unsigned long const, 18446744073709551615ul>::data() const Unexecuted instantiation: jsoncons::detail::span<signed char const, 18446744073709551615ul>::data() const Unexecuted instantiation: jsoncons::detail::span<short const, 18446744073709551615ul>::data() const Unexecuted instantiation: jsoncons::detail::span<int const, 18446744073709551615ul>::data() const Unexecuted instantiation: jsoncons::detail::span<long const, 18446744073709551615ul>::data() const Unexecuted instantiation: jsoncons::detail::span<float const, 18446744073709551615ul>::data() const Unexecuted instantiation: jsoncons::detail::span<double const, 18446744073709551615ul>::data() const jsoncons::detail::span<unsigned char, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 464k | { | 112 | 464k | return data_; | 113 | 464k | } |
jsoncons::detail::span<unsigned short, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 82.3k | { | 112 | 82.3k | return data_; | 113 | 82.3k | } |
jsoncons::detail::span<unsigned int, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 11.6k | { | 112 | 11.6k | return data_; | 113 | 11.6k | } |
jsoncons::detail::span<unsigned long, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 32.3k | { | 112 | 32.3k | return data_; | 113 | 32.3k | } |
jsoncons::detail::span<signed char, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 7.88k | { | 112 | 7.88k | return data_; | 113 | 7.88k | } |
jsoncons::detail::span<short, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 25.5k | { | 112 | 25.5k | return data_; | 113 | 25.5k | } |
jsoncons::detail::span<int, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 12.5k | { | 112 | 12.5k | return data_; | 113 | 12.5k | } |
jsoncons::detail::span<long, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 15.2k | { | 112 | 15.2k | return data_; | 113 | 15.2k | } |
jsoncons::detail::span<float, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 21.8k | { | 112 | 21.8k | return data_; | 113 | 21.8k | } |
jsoncons::detail::span<double, 18446744073709551615ul>::data() const Line | Count | Source | 111 | 10.6k | { | 112 | 10.6k | return data_; | 113 | 10.6k | } |
|
114 | | |
115 | | constexpr size_type size() const noexcept |
116 | 200M | { |
117 | 200M | return size_; |
118 | 200M | } jsoncons::detail::span<unsigned char const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 95.3M | { | 117 | 95.3M | return size_; | 118 | 95.3M | } |
jsoncons::detail::span<unsigned short const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 47.8M | { | 117 | 47.8M | return size_; | 118 | 47.8M | } |
jsoncons::detail::span<unsigned int const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 3.13M | { | 117 | 3.13M | return size_; | 118 | 3.13M | } |
jsoncons::detail::span<unsigned long const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 692k | { | 117 | 692k | return size_; | 118 | 692k | } |
jsoncons::detail::span<signed char const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 7.80M | { | 117 | 7.80M | return size_; | 118 | 7.80M | } |
jsoncons::detail::span<short const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 2.44M | { | 117 | 2.44M | return size_; | 118 | 2.44M | } |
jsoncons::detail::span<int const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 2.78M | { | 117 | 2.78M | return size_; | 118 | 2.78M | } |
jsoncons::detail::span<long const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 1.68M | { | 117 | 1.68M | return size_; | 118 | 1.68M | } |
jsoncons::detail::span<float const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 829k | { | 117 | 829k | return size_; | 118 | 829k | } |
jsoncons::detail::span<double const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 311k | { | 117 | 311k | return size_; | 118 | 311k | } |
jsoncons::detail::span<char const, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 113k | { | 117 | 113k | return size_; | 118 | 113k | } |
jsoncons::detail::span<unsigned char, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 464k | { | 117 | 464k | return size_; | 118 | 464k | } |
jsoncons::detail::span<unsigned short, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 25.7M | { | 117 | 25.7M | return size_; | 118 | 25.7M | } |
jsoncons::detail::span<unsigned int, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 3.12M | { | 117 | 3.12M | return size_; | 118 | 3.12M | } |
jsoncons::detail::span<unsigned long, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 638k | { | 117 | 638k | return size_; | 118 | 638k | } |
jsoncons::detail::span<signed char, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 16.1k | { | 117 | 16.1k | return size_; | 118 | 16.1k | } |
jsoncons::detail::span<short, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 2.01M | { | 117 | 2.01M | return size_; | 118 | 2.01M | } |
jsoncons::detail::span<int, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 2.75M | { | 117 | 2.75M | return size_; | 118 | 2.75M | } |
jsoncons::detail::span<long, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 1.68M | { | 117 | 1.68M | return size_; | 118 | 1.68M | } |
jsoncons::detail::span<float, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 692k | { | 117 | 692k | return size_; | 118 | 692k | } |
jsoncons::detail::span<double, 18446744073709551615ul>::size() const Line | Count | Source | 116 | 252k | { | 117 | 252k | return size_; | 118 | 252k | } |
|
119 | | |
120 | | constexpr bool empty() const noexcept |
121 | 12.4k | { |
122 | 12.4k | return size_ == 0; |
123 | 12.4k | } |
124 | | |
125 | | constexpr reference operator[](size_type index) const |
126 | 144M | { |
127 | 144M | return data_[index]; |
128 | 144M | } jsoncons::detail::span<unsigned char const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 5.03M | { | 127 | 5.03M | return data_[index]; | 128 | 5.03M | } |
jsoncons::detail::span<unsigned short, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 51.1M | { | 127 | 51.1M | return data_[index]; | 128 | 51.1M | } |
jsoncons::detail::span<unsigned short const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 47.6M | { | 127 | 47.6M | return data_[index]; | 128 | 47.6M | } |
jsoncons::detail::span<unsigned int, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 6.17M | { | 127 | 6.17M | return data_[index]; | 128 | 6.17M | } |
jsoncons::detail::span<unsigned int const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 3.09M | { | 127 | 3.09M | return data_[index]; | 128 | 3.09M | } |
jsoncons::detail::span<unsigned long, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 1.12M | { | 127 | 1.12M | return data_[index]; | 128 | 1.12M | } |
jsoncons::detail::span<unsigned long const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 637k | { | 127 | 637k | return data_[index]; | 128 | 637k | } |
jsoncons::detail::span<signed char const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 7.78M | { | 127 | 7.78M | return data_[index]; | 128 | 7.78M | } |
jsoncons::detail::span<short, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 3.88M | { | 127 | 3.88M | return data_[index]; | 128 | 3.88M | } |
jsoncons::detail::span<short const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 2.37M | { | 127 | 2.37M | return data_[index]; | 128 | 2.37M | } |
jsoncons::detail::span<int, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 5.44M | { | 127 | 5.44M | return data_[index]; | 128 | 5.44M | } |
jsoncons::detail::span<int const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 2.74M | { | 127 | 2.74M | return data_[index]; | 128 | 2.74M | } |
jsoncons::detail::span<long, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 3.27M | { | 127 | 3.27M | return data_[index]; | 128 | 3.27M | } |
jsoncons::detail::span<long const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 1.64M | { | 127 | 1.64M | return data_[index]; | 128 | 1.64M | } |
jsoncons::detail::span<float, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 1.27M | { | 127 | 1.27M | return data_[index]; | 128 | 1.27M | } |
jsoncons::detail::span<float const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 766k | { | 127 | 766k | return data_[index]; | 128 | 766k | } |
jsoncons::detail::span<double, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 448k | { | 127 | 448k | return data_[index]; | 128 | 448k | } |
jsoncons::detail::span<double const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 126 | 282k | { | 127 | 282k | return data_[index]; | 128 | 282k | } |
|
129 | | |
130 | | // iterator support |
131 | | const_iterator begin() const noexcept |
132 | 0 | { |
133 | 0 | return data_; |
134 | 0 | } Unexecuted instantiation: jsoncons::detail::span<unsigned char const, 18446744073709551615ul>::begin() const Unexecuted instantiation: jsoncons::detail::span<unsigned short const, 18446744073709551615ul>::begin() const Unexecuted instantiation: jsoncons::detail::span<unsigned int const, 18446744073709551615ul>::begin() const Unexecuted instantiation: jsoncons::detail::span<unsigned long const, 18446744073709551615ul>::begin() const Unexecuted instantiation: jsoncons::detail::span<signed char const, 18446744073709551615ul>::begin() const Unexecuted instantiation: jsoncons::detail::span<short const, 18446744073709551615ul>::begin() const Unexecuted instantiation: jsoncons::detail::span<int const, 18446744073709551615ul>::begin() const Unexecuted instantiation: jsoncons::detail::span<long const, 18446744073709551615ul>::begin() const Unexecuted instantiation: jsoncons::detail::span<float const, 18446744073709551615ul>::begin() const Unexecuted instantiation: jsoncons::detail::span<double const, 18446744073709551615ul>::begin() const |
135 | | const_iterator end() const noexcept |
136 | 0 | { |
137 | 0 | return data_ + size_; |
138 | 0 | } Unexecuted instantiation: jsoncons::detail::span<unsigned char const, 18446744073709551615ul>::end() const Unexecuted instantiation: jsoncons::detail::span<unsigned short const, 18446744073709551615ul>::end() const Unexecuted instantiation: jsoncons::detail::span<unsigned int const, 18446744073709551615ul>::end() const Unexecuted instantiation: jsoncons::detail::span<unsigned long const, 18446744073709551615ul>::end() const Unexecuted instantiation: jsoncons::detail::span<signed char const, 18446744073709551615ul>::end() const Unexecuted instantiation: jsoncons::detail::span<short const, 18446744073709551615ul>::end() const Unexecuted instantiation: jsoncons::detail::span<int const, 18446744073709551615ul>::end() const Unexecuted instantiation: jsoncons::detail::span<long const, 18446744073709551615ul>::end() const Unexecuted instantiation: jsoncons::detail::span<float const, 18446744073709551615ul>::end() const Unexecuted instantiation: jsoncons::detail::span<double const, 18446744073709551615ul>::end() const |
139 | | const_iterator cbegin() const noexcept |
140 | | { |
141 | | return data_; |
142 | | } |
143 | | const_iterator cend() const noexcept |
144 | | { |
145 | | return data_ + size_; |
146 | | } |
147 | | const_reverse_iterator rbegin() const noexcept |
148 | | { |
149 | | return const_reverse_iterator(end()); |
150 | | } |
151 | | const_reverse_iterator rend() const noexcept |
152 | | { |
153 | | return const_reverse_iterator(begin()); |
154 | | } |
155 | | const_reverse_iterator crbegin() const noexcept |
156 | | { |
157 | | return const_reverse_iterator(end()); |
158 | | } |
159 | | const_reverse_iterator crend() const noexcept |
160 | | { |
161 | | return const_reverse_iterator(begin()); |
162 | | } |
163 | | |
164 | | span<element_type, dynamic_extent> |
165 | | first(std::size_t count) const |
166 | | { |
167 | | JSONCONS_ASSERT(count <= size()); |
168 | | |
169 | | return span< element_type, dynamic_extent >( data(), count ); |
170 | | } |
171 | | |
172 | | span<element_type, dynamic_extent> |
173 | | last(std::size_t count) const |
174 | | { |
175 | | JSONCONS_ASSERT(count <= size()); |
176 | | |
177 | | return span<element_type, dynamic_extent>(data() + ( size() - count ), count); |
178 | | } |
179 | | |
180 | | span<element_type, dynamic_extent> |
181 | | subspan(std::size_t offset, std::size_t count = dynamic_extent) const |
182 | | { |
183 | | //JSONCONS_ASSERT((offset <= size() && (count == dynamic_extent || (offset + count <= size())))); |
184 | | |
185 | | return span<element_type, dynamic_extent>( |
186 | | data() + offset, count == dynamic_extent ? size() - offset : count ); |
187 | | } |
188 | | }; |
189 | | |
190 | | } // namespace detail |
191 | | } // namespace jsoncons |
192 | | |
193 | | #endif // JSONCONS_DETAIL_SPAN_HPP |