/src/boringssl/include/openssl/span.h
Line | Count | Source |
1 | | // Copyright 2017 The BoringSSL Authors |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // https://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | |
15 | | #ifndef OPENSSL_HEADER_SSL_SPAN_H |
16 | | #define OPENSSL_HEADER_SSL_SPAN_H |
17 | | |
18 | | #include <openssl/base.h> // IWYU pragma: export |
19 | | |
20 | | #if !defined(BORINGSSL_NO_CXX) |
21 | | |
22 | | // Work around consumers including our headers under extern "C". |
23 | | extern "C++" { |
24 | | |
25 | | #include <stdlib.h> |
26 | | |
27 | | #include <algorithm> |
28 | | #include <array> |
29 | | #include <limits> |
30 | | #include <string_view> |
31 | | #include <type_traits> |
32 | | |
33 | | #if __has_include(<version>) |
34 | | #include <version> |
35 | | #endif |
36 | | |
37 | | #if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L |
38 | | #include <ranges> |
39 | | #endif |
40 | | |
41 | | BSSL_NAMESPACE_BEGIN |
42 | | inline constexpr size_t dynamic_extent = std::numeric_limits<size_t>::max(); |
43 | | |
44 | | template <typename T, size_t N = dynamic_extent> |
45 | | class Span; |
46 | | BSSL_NAMESPACE_END |
47 | | |
48 | | #if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L |
49 | | // Mark `Span` as satisfying the `view` and `borrowed_range` concepts. This |
50 | | // should be done before the definition of `Span`, so that any inlined calls to |
51 | | // range functionality use the correct specializations. |
52 | | template <typename T, size_t N> |
53 | | inline constexpr bool std::ranges::enable_view<bssl::Span<T, N>> = true; |
54 | | template <typename T, size_t N> |
55 | | inline constexpr bool std::ranges::enable_borrowed_range<bssl::Span<T, N>> = |
56 | | true; |
57 | | #endif |
58 | | |
59 | | BSSL_NAMESPACE_BEGIN |
60 | | |
61 | | namespace internal { |
62 | | template <typename T> |
63 | | class SpanBase { |
64 | | // Put comparison operator implementations into a base class with const T, so |
65 | | // they can be used with any type that implicitly converts into a Span. |
66 | | static_assert(std::is_const_v<T>, |
67 | | "Span<T> must be derived from SpanBase<const T>"); |
68 | | |
69 | 1.54M | friend bool operator==(Span<T> lhs, Span<T> rhs) { |
70 | 1.54M | return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); |
71 | 1.54M | } |
72 | | |
73 | 1.11M | friend bool operator!=(Span<T> lhs, Span<T> rhs) { return !(lhs == rhs); } |
74 | | }; |
75 | | |
76 | | // Container class to store the size of a span at runtime or compile time. |
77 | | template <typename T, size_t N> |
78 | | class SpanStorage : private SpanBase<const T> { |
79 | | public: |
80 | 230k | constexpr SpanStorage(T *data, size_t size) : data_(data) { |
81 | 230k | BSSL_CHECK(size == N); |
82 | 230k | } Unexecuted instantiation: bssl::internal::SpanStorage<unsigned char const, 65ul>::SpanStorage(unsigned char const*, unsigned long) bssl::internal::SpanStorage<unsigned char const, 16ul>::SpanStorage(unsigned char const*, unsigned long) Line | Count | Source | 80 | 128 | constexpr SpanStorage(T *data, size_t size) : data_(data) { | 81 | 128 | BSSL_CHECK(size == N); | 82 | 128 | } |
bssl::internal::SpanStorage<unsigned char, 32ul>::SpanStorage(unsigned char*, unsigned long) Line | Count | Source | 80 | 56.4k | constexpr SpanStorage(T *data, size_t size) : data_(data) { | 81 | 56.4k | BSSL_CHECK(size == N); | 82 | 56.4k | } |
bssl::internal::SpanStorage<unsigned char, 8ul>::SpanStorage(unsigned char*, unsigned long) Line | Count | Source | 80 | 8.93k | constexpr SpanStorage(T *data, size_t size) : data_(data) { | 81 | 8.93k | BSSL_CHECK(size == N); | 82 | 8.93k | } |
bssl::internal::SpanStorage<unsigned char const, 4ul>::SpanStorage(unsigned char const*, unsigned long) Line | Count | Source | 80 | 30.6k | constexpr SpanStorage(T *data, size_t size) : data_(data) { | 81 | 30.6k | BSSL_CHECK(size == N); | 82 | 30.6k | } |
bssl::internal::SpanStorage<unsigned char const, 6ul>::SpanStorage(unsigned char const*, unsigned long) Line | Count | Source | 80 | 7.17k | constexpr SpanStorage(T *data, size_t size) : data_(data) { | 81 | 7.17k | BSSL_CHECK(size == N); | 82 | 7.17k | } |
Unexecuted instantiation: bssl::internal::SpanStorage<ssl_cipher_st const, 24ul>::SpanStorage(ssl_cipher_st const*, unsigned long) bssl::internal::SpanStorage<unsigned short const, 3ul>::SpanStorage(unsigned short const*, unsigned long) Line | Count | Source | 80 | 7.66k | constexpr SpanStorage(T *data, size_t size) : data_(data) { | 81 | 7.66k | BSSL_CHECK(size == N); | 82 | 7.66k | } |
Unexecuted instantiation: bssl::internal::SpanStorage<bssl::NamedGroup const, 7ul>::SpanStorage(bssl::NamedGroup const*, unsigned long) Unexecuted instantiation: bssl::internal::SpanStorage<char const* const, 3ul>::SpanStorage(char const* const*, unsigned long) Unexecuted instantiation: bssl::internal::SpanStorage<SignatureAlgorithmName const, 14ul>::SpanStorage(SignatureAlgorithmName const*, unsigned long) Unexecuted instantiation: bssl::internal::SpanStorage<bssl::VersionInfo const, 7ul>::SpanStorage(bssl::VersionInfo const*, unsigned long) bssl::internal::SpanStorage<unsigned char const, 32ul>::SpanStorage(unsigned char const*, unsigned long) Line | Count | Source | 80 | 194 | constexpr SpanStorage(T *data, size_t size) : data_(data) { | 81 | 194 | BSSL_CHECK(size == N); | 82 | 194 | } |
bssl::internal::SpanStorage<unsigned char, 80ul>::SpanStorage(unsigned char*, unsigned long) Line | Count | Source | 80 | 57.5k | constexpr SpanStorage(T *data, size_t size) : data_(data) { | 81 | 57.5k | BSSL_CHECK(size == N); | 82 | 57.5k | } |
bssl::internal::SpanStorage<unsigned char, 24ul>::SpanStorage(unsigned char*, unsigned long) Line | Count | Source | 80 | 57.5k | constexpr SpanStorage(T *data, size_t size) : data_(data) { | 81 | 57.5k | BSSL_CHECK(size == N); | 82 | 57.5k | } |
bssl::internal::SpanStorage<unsigned char const, 9ul>::SpanStorage(unsigned char const*, unsigned long) Line | Count | Source | 80 | 4.75k | constexpr SpanStorage(T *data, size_t size) : data_(data) { | 81 | 4.75k | BSSL_CHECK(size == N); | 82 | 4.75k | } |
|
83 | 248k | constexpr T *data() const { return data_; }Unexecuted instantiation: bssl::internal::SpanStorage<unsigned char const, 65ul>::data() const bssl::internal::SpanStorage<unsigned char const, 16ul>::data() const Line | Count | Source | 83 | 128 | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<unsigned char, 32ul>::data() const Line | Count | Source | 83 | 56.4k | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<unsigned char, 8ul>::data() const Line | Count | Source | 83 | 26.3k | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<unsigned char const, 4ul>::data() const Line | Count | Source | 83 | 30.6k | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<unsigned char const, 6ul>::data() const Line | Count | Source | 83 | 7.17k | constexpr T *data() const { return data_; } |
Unexecuted instantiation: bssl::internal::SpanStorage<ssl_cipher_st const, 24ul>::data() const bssl::internal::SpanStorage<unsigned short const, 3ul>::data() const Line | Count | Source | 83 | 7.66k | constexpr T *data() const { return data_; } |
Unexecuted instantiation: bssl::internal::SpanStorage<bssl::NamedGroup const, 7ul>::data() const Unexecuted instantiation: bssl::internal::SpanStorage<char const* const, 3ul>::data() const Unexecuted instantiation: bssl::internal::SpanStorage<SignatureAlgorithmName const, 14ul>::data() const Unexecuted instantiation: bssl::internal::SpanStorage<bssl::VersionInfo const, 7ul>::data() const bssl::internal::SpanStorage<unsigned char, 80ul>::data() const Line | Count | Source | 83 | 57.5k | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<unsigned char, 24ul>::data() const Line | Count | Source | 83 | 57.5k | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<unsigned char const, 32ul>::data() const Line | Count | Source | 83 | 194 | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<unsigned char const, 9ul>::data() const Line | Count | Source | 83 | 4.75k | constexpr T *data() const { return data_; } |
|
84 | 267k | constexpr size_t size() const { return N; }Unexecuted instantiation: bssl::internal::SpanStorage<unsigned char const, 65ul>::size() const bssl::internal::SpanStorage<unsigned char const, 16ul>::size() const Line | Count | Source | 84 | 128 | constexpr size_t size() const { return N; } |
bssl::internal::SpanStorage<unsigned char, 32ul>::size() const Line | Count | Source | 84 | 66.5k | constexpr size_t size() const { return N; } |
bssl::internal::SpanStorage<unsigned char, 8ul>::size() const Line | Count | Source | 84 | 26.2k | constexpr size_t size() const { return N; } |
bssl::internal::SpanStorage<unsigned char const, 4ul>::size() const Line | Count | Source | 84 | 32.7k | constexpr size_t size() const { return N; } |
bssl::internal::SpanStorage<unsigned char const, 6ul>::size() const Line | Count | Source | 84 | 14.3k | constexpr size_t size() const { return N; } |
Unexecuted instantiation: bssl::internal::SpanStorage<ssl_cipher_st const, 24ul>::size() const bssl::internal::SpanStorage<unsigned short const, 3ul>::size() const Line | Count | Source | 84 | 7.66k | constexpr size_t size() const { return N; } |
Unexecuted instantiation: bssl::internal::SpanStorage<bssl::NamedGroup const, 7ul>::size() const Unexecuted instantiation: bssl::internal::SpanStorage<char const* const, 3ul>::size() const Unexecuted instantiation: bssl::internal::SpanStorage<SignatureAlgorithmName const, 14ul>::size() const Unexecuted instantiation: bssl::internal::SpanStorage<bssl::VersionInfo const, 7ul>::size() const bssl::internal::SpanStorage<unsigned char, 80ul>::size() const Line | Count | Source | 84 | 57.5k | constexpr size_t size() const { return N; } |
bssl::internal::SpanStorage<unsigned char, 24ul>::size() const Line | Count | Source | 84 | 57.5k | constexpr size_t size() const { return N; } |
bssl::internal::SpanStorage<unsigned char const, 32ul>::size() const Line | Count | Source | 84 | 194 | constexpr size_t size() const { return N; } |
bssl::internal::SpanStorage<unsigned char const, 9ul>::size() const Line | Count | Source | 84 | 4.75k | constexpr size_t size() const { return N; } |
|
85 | | |
86 | | private: |
87 | | T *data_; |
88 | | }; |
89 | | |
90 | | template <typename T> |
91 | | class SpanStorage<T, dynamic_extent> : private SpanBase<const T> { |
92 | | public: |
93 | 39.9M | constexpr SpanStorage(T *data, size_t size) : data_(data), size_(size) {}bssl::internal::SpanStorage<unsigned char const, 18446744073709551615ul>::SpanStorage(unsigned char const*, unsigned long) Line | Count | Source | 93 | 30.1M | constexpr SpanStorage(T *data, size_t size) : data_(data), size_(size) {} |
bssl::internal::SpanStorage<unsigned char, 18446744073709551615ul>::SpanStorage(unsigned char*, unsigned long) Line | Count | Source | 93 | 7.77M | constexpr SpanStorage(T *data, size_t size) : data_(data), size_(size) {} |
bssl::internal::SpanStorage<unsigned short const, 18446744073709551615ul>::SpanStorage(unsigned short const*, unsigned long) Line | Count | Source | 93 | 1.28M | constexpr SpanStorage(T *data, size_t size) : data_(data), size_(size) {} |
Unexecuted instantiation: bssl::internal::SpanStorage<ssl_cipher_st const, 18446744073709551615ul>::SpanStorage(ssl_cipher_st const*, unsigned long) bssl::internal::SpanStorage<bool const, 18446744073709551615ul>::SpanStorage(bool const*, unsigned long) Line | Count | Source | 93 | 16.2k | constexpr SpanStorage(T *data, size_t size) : data_(data), size_(size) {} |
Unexecuted instantiation: bssl::internal::SpanStorage<char const* const, 18446744073709551615ul>::SpanStorage(char const* const*, unsigned long) Unexecuted instantiation: bssl::internal::SpanStorage<char const*, 18446744073709551615ul>::SpanStorage(char const**, unsigned long) Unexecuted instantiation: bssl::internal::SpanStorage<unsigned short, 18446744073709551615ul>::SpanStorage(unsigned short*, unsigned long) Unexecuted instantiation: bssl::internal::SpanStorage<bssl::NamedGroup const, 18446744073709551615ul>::SpanStorage(bssl::NamedGroup const*, unsigned long) bssl::internal::SpanStorage<int const, 18446744073709551615ul>::SpanStorage(int const*, unsigned long) Line | Count | Source | 93 | 5.89k | constexpr SpanStorage(T *data, size_t size) : data_(data), size_(size) {} |
bssl::internal::SpanStorage<char const, 18446744073709551615ul>::SpanStorage(char const*, unsigned long) Line | Count | Source | 93 | 9.11k | constexpr SpanStorage(T *data, size_t size) : data_(data), size_(size) {} |
bssl::internal::SpanStorage<ec_group_st const*, 18446744073709551615ul>::SpanStorage(ec_group_st const**, unsigned long) Line | Count | Source | 93 | 138k | constexpr SpanStorage(T *data, size_t size) : data_(data), size_(size) {} |
bssl::internal::SpanStorage<ec_group_st const* const, 18446744073709551615ul>::SpanStorage(ec_group_st const* const*, unsigned long) Line | Count | Source | 93 | 143k | constexpr SpanStorage(T *data, size_t size) : data_(data), size_(size) {} |
bssl::internal::SpanStorage<evp_pkey_alg_st const* const, 18446744073709551615ul>::SpanStorage(evp_pkey_alg_st const* const*, unsigned long) Line | Count | Source | 93 | 433k | constexpr SpanStorage(T *data, size_t size) : data_(data), size_(size) {} |
Unexecuted instantiation: bssl::internal::SpanStorage<evp_pkey_alg_st const*, 18446744073709551615ul>::SpanStorage(evp_pkey_alg_st const**, unsigned long) |
94 | 42.7M | constexpr T *data() const { return data_; }bssl::internal::SpanStorage<unsigned char const, 18446744073709551615ul>::data() const Line | Count | Source | 94 | 31.3M | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<unsigned char, 18446744073709551615ul>::data() const Line | Count | Source | 94 | 7.29M | constexpr T *data() const { return data_; } |
Unexecuted instantiation: bssl::internal::SpanStorage<char const*, 18446744073709551615ul>::data() const bssl::internal::SpanStorage<unsigned short const, 18446744073709551615ul>::data() const Line | Count | Source | 94 | 3.04M | constexpr T *data() const { return data_; } |
Unexecuted instantiation: bssl::internal::SpanStorage<ssl_cipher_st const, 18446744073709551615ul>::data() const Unexecuted instantiation: bssl::internal::SpanStorage<bssl::NamedGroup const, 18446744073709551615ul>::data() const bssl::internal::SpanStorage<bool const, 18446744073709551615ul>::data() const Line | Count | Source | 94 | 32.4k | constexpr T *data() const { return data_; } |
Unexecuted instantiation: bssl::internal::SpanStorage<char const* const, 18446744073709551615ul>::data() const Unexecuted instantiation: bssl::internal::SpanStorage<unsigned short, 18446744073709551615ul>::data() const bssl::internal::SpanStorage<int const, 18446744073709551615ul>::data() const Line | Count | Source | 94 | 5.92k | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<char const, 18446744073709551615ul>::data() const Line | Count | Source | 94 | 4.55k | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<ec_group_st const*, 18446744073709551615ul>::data() const Line | Count | Source | 94 | 138k | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<ec_group_st const* const, 18446744073709551615ul>::data() const Line | Count | Source | 94 | 240k | constexpr T *data() const { return data_; } |
bssl::internal::SpanStorage<evp_pkey_alg_st const* const, 18446744073709551615ul>::data() const Line | Count | Source | 94 | 687k | constexpr T *data() const { return data_; } |
Unexecuted instantiation: bssl::internal::SpanStorage<evp_pkey_alg_st const*, 18446744073709551615ul>::data() const |
95 | 79.4M | constexpr size_t size() const { return size_; }bssl::internal::SpanStorage<unsigned char const, 18446744073709551615ul>::size() const Line | Count | Source | 95 | 64.2M | constexpr size_t size() const { return size_; } |
bssl::internal::SpanStorage<unsigned char, 18446744073709551615ul>::size() const Line | Count | Source | 95 | 11.8M | constexpr size_t size() const { return size_; } |
Unexecuted instantiation: bssl::internal::SpanStorage<char const*, 18446744073709551615ul>::size() const bssl::internal::SpanStorage<unsigned short const, 18446744073709551615ul>::size() const Line | Count | Source | 95 | 2.48M | constexpr size_t size() const { return size_; } |
Unexecuted instantiation: bssl::internal::SpanStorage<ssl_cipher_st const, 18446744073709551615ul>::size() const Unexecuted instantiation: bssl::internal::SpanStorage<bssl::NamedGroup const, 18446744073709551615ul>::size() const bssl::internal::SpanStorage<bool const, 18446744073709551615ul>::size() const Line | Count | Source | 95 | 48.6k | constexpr size_t size() const { return size_; } |
Unexecuted instantiation: bssl::internal::SpanStorage<char const* const, 18446744073709551615ul>::size() const Unexecuted instantiation: bssl::internal::SpanStorage<unsigned short, 18446744073709551615ul>::size() const bssl::internal::SpanStorage<int const, 18446744073709551615ul>::size() const Line | Count | Source | 95 | 23.1k | constexpr size_t size() const { return size_; } |
bssl::internal::SpanStorage<char const, 18446744073709551615ul>::size() const Line | Count | Source | 95 | 4.55k | constexpr size_t size() const { return size_; } |
bssl::internal::SpanStorage<ec_group_st const*, 18446744073709551615ul>::size() const Line | Count | Source | 95 | 138k | constexpr size_t size() const { return size_; } |
bssl::internal::SpanStorage<ec_group_st const* const, 18446744073709551615ul>::size() const Line | Count | Source | 95 | 120k | constexpr size_t size() const { return size_; } |
bssl::internal::SpanStorage<evp_pkey_alg_st const* const, 18446744073709551615ul>::size() const Line | Count | Source | 95 | 432k | constexpr size_t size() const { return size_; } |
Unexecuted instantiation: bssl::internal::SpanStorage<evp_pkey_alg_st const*, 18446744073709551615ul>::size() const |
96 | | |
97 | | private: |
98 | | T *data_; |
99 | | size_t size_; |
100 | | }; |
101 | | |
102 | | // Heuristically test whether C is a container type that can be converted into |
103 | | // a Span<T> by checking for data() and size() member functions. |
104 | | template <typename C, typename T> |
105 | | using EnableIfContainer = std::enable_if_t< |
106 | | std::is_convertible_v<decltype(std::declval<C>().data()), T *> && |
107 | | std::is_integral_v<decltype(std::declval<C>().size())>>; |
108 | | |
109 | | // A fake type used to be able to SFINAE between two different container |
110 | | // constructors - by giving one this as a second default argument, and one not. |
111 | | struct AllowRedeclaringConstructor {}; |
112 | | |
113 | | } // namespace internal |
114 | | |
115 | | // A Span<T> is a non-owning reference to a contiguous array of objects of type |
116 | | // |T|. Conceptually, a Span is a simple a pointer to |T| and a count of |
117 | | // elements accessible via that pointer. The elements referenced by the Span can |
118 | | // be mutated if |T| is mutable. |
119 | | // |
120 | | // A Span can be constructed from container types implementing |data()| and |
121 | | // |size()| methods. If |T| is constant, construction from a container type is |
122 | | // implicit. This allows writing methods that accept data from some unspecified |
123 | | // container type: |
124 | | // |
125 | | // // Foo views data referenced by v. |
126 | | // void Foo(bssl::Span<const uint8_t> v) { ... } |
127 | | // |
128 | | // std::vector<uint8_t> vec; |
129 | | // Foo(vec); |
130 | | // |
131 | | // For mutable Spans, conversion is explicit: |
132 | | // |
133 | | // // FooMutate mutates data referenced by v. |
134 | | // void FooMutate(bssl::Span<uint8_t> v) { ... } |
135 | | // |
136 | | // FooMutate(bssl::Span<uint8_t>(vec)); |
137 | | // |
138 | | // You can also use C++17 class template argument deduction to construct Spans |
139 | | // in order to deduce the type of the Span automatically. |
140 | | // |
141 | | // FooMutate(bssl::Span(vec)); |
142 | | // |
143 | | // Note that Spans have value type semantics. They are cheap to construct and |
144 | | // copy, and should be passed by value whenever a method would otherwise accept |
145 | | // a reference or pointer to a container or array. |
146 | | template <typename T, size_t N> |
147 | | class Span : public internal::SpanStorage<T, N> { |
148 | | public: |
149 | | using element_type = T; |
150 | | using value_type = std::remove_cv_t<T>; |
151 | | using size_type = size_t; |
152 | | using difference_type = ptrdiff_t; |
153 | | using pointer = T *; |
154 | | using const_pointer = const T *; |
155 | | using reference = T &; |
156 | | using const_reference = const T &; |
157 | | using iterator = T *; |
158 | | using const_iterator = const T *; |
159 | | |
160 | | template <typename U = T, |
161 | | typename = std::enable_if_t<N == 0 || N == dynamic_extent, U>> |
162 | 6.99M | constexpr Span() : internal::SpanStorage<T, N>(nullptr, 0) {}bssl::Span<unsigned char const, 18446744073709551615ul>::Span<unsigned char const, unsigned char const>() Line | Count | Source | 162 | 4.65M | constexpr Span() : internal::SpanStorage<T, N>(nullptr, 0) {} |
bssl::Span<unsigned short const, 18446744073709551615ul>::Span<unsigned short const, unsigned short const>() Line | Count | Source | 162 | 65.3k | constexpr Span() : internal::SpanStorage<T, N>(nullptr, 0) {} |
bssl::Span<unsigned char, 18446744073709551615ul>::Span<unsigned char, unsigned char>() Line | Count | Source | 162 | 2.26M | constexpr Span() : internal::SpanStorage<T, N>(nullptr, 0) {} |
Unexecuted instantiation: bssl::Span<char const* const, 18446744073709551615ul>::Span<char const* const, char const* const>() bssl::Span<char const, 18446744073709551615ul>::Span<char const, char const>() Line | Count | Source | 162 | 4.55k | constexpr Span() : internal::SpanStorage<T, N>(nullptr, 0) {} |
bssl::Span<ec_group_st const* const, 18446744073709551615ul>::Span<ec_group_st const* const, ec_group_st const* const>() Line | Count | Source | 162 | 3.23k | constexpr Span() : internal::SpanStorage<T, N>(nullptr, 0) {} |
|
163 | | |
164 | | // NOTE: This constructor may abort() at runtime if len differs from the |
165 | | // compile-time size, if any. |
166 | 22.6M | constexpr Span(T *ptr, size_t len) : internal::SpanStorage<T, N>(ptr, len) {}bssl::Span<unsigned char const, 18446744073709551615ul>::Span(unsigned char const*, unsigned long) Line | Count | Source | 166 | 16.9M | constexpr Span(T *ptr, size_t len) : internal::SpanStorage<T, N>(ptr, len) {} |
bssl::Span<unsigned char, 18446744073709551615ul>::Span(unsigned char*, unsigned long) Line | Count | Source | 166 | 5.04M | constexpr Span(T *ptr, size_t len) : internal::SpanStorage<T, N>(ptr, len) {} |
Unexecuted instantiation: bssl::Span<unsigned char const, 65ul>::Span(unsigned char const*, unsigned long) bssl::Span<unsigned char const, 16ul>::Span(unsigned char const*, unsigned long) Line | Count | Source | 166 | 128 | constexpr Span(T *ptr, size_t len) : internal::SpanStorage<T, N>(ptr, len) {} |
bssl::Span<unsigned short const, 18446744073709551615ul>::Span(unsigned short const*, unsigned long) Line | Count | Source | 166 | 11.3k | constexpr Span(T *ptr, size_t len) : internal::SpanStorage<T, N>(ptr, len) {} |
bssl::Span<unsigned char, 8ul>::Span(unsigned char*, unsigned long) Line | Count | Source | 166 | 8.93k | constexpr Span(T *ptr, size_t len) : internal::SpanStorage<T, N>(ptr, len) {} |
Unexecuted instantiation: bssl::Span<bool const, 18446744073709551615ul>::Span(bool const*, unsigned long) Unexecuted instantiation: bssl::Span<char const* const, 18446744073709551615ul>::Span(char const* const*, unsigned long) Unexecuted instantiation: bssl::Span<char const*, 18446744073709551615ul>::Span(char const**, unsigned long) Unexecuted instantiation: bssl::Span<unsigned short, 18446744073709551615ul>::Span(unsigned short*, unsigned long) bssl::Span<int const, 18446744073709551615ul>::Span(int const*, unsigned long) Line | Count | Source | 166 | 5.89k | constexpr Span(T *ptr, size_t len) : internal::SpanStorage<T, N>(ptr, len) {} |
bssl::Span<unsigned char const, 4ul>::Span(unsigned char const*, unsigned long) Line | Count | Source | 166 | 28.5k | constexpr Span(T *ptr, size_t len) : internal::SpanStorage<T, N>(ptr, len) {} |
bssl::Span<ec_group_st const*, 18446744073709551615ul>::Span(ec_group_st const**, unsigned long) Line | Count | Source | 166 | 138k | constexpr Span(T *ptr, size_t len) : internal::SpanStorage<T, N>(ptr, len) {} |
bssl::Span<evp_pkey_alg_st const* const, 18446744073709551615ul>::Span(evp_pkey_alg_st const* const*, unsigned long) Line | Count | Source | 166 | 433k | constexpr Span(T *ptr, size_t len) : internal::SpanStorage<T, N>(ptr, len) {} |
Unexecuted instantiation: bssl::Span<evp_pkey_alg_st const*, 18446744073709551615ul>::Span(evp_pkey_alg_st const**, unsigned long) |
167 | | |
168 | | template <size_t NA, |
169 | | typename = std::enable_if_t<N == NA || N == dynamic_extent>> |
170 | | // NOLINTNEXTLINE(google-explicit-constructor): same as std::span. |
171 | 1.36M | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {}bssl::Span<unsigned char const, 18446744073709551615ul>::Span<1ul, void>(unsigned char const (&) [1ul]) Line | Count | Source | 171 | 107k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned short const, 18446744073709551615ul>::Span<9ul, void>(unsigned short const (&) [9ul]) Line | Count | Source | 171 | 117k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
Unexecuted instantiation: bssl::Span<unsigned char, 18446744073709551615ul>::Span<65ul, void>(unsigned char (&) [65ul]) bssl::Span<unsigned char, 18446744073709551615ul>::Span<32ul, void>(unsigned char (&) [32ul]) Line | Count | Source | 171 | 19.2k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<32ul, void>(unsigned char const (&) [32ul]) Line | Count | Source | 171 | 115k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<16ul, void>(unsigned char const (&) [16ul]) Line | Count | Source | 171 | 128 | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned short const, 18446744073709551615ul>::Span<2ul, void>(unsigned short const (&) [2ul]) Line | Count | Source | 171 | 6.49k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned short const, 18446744073709551615ul>::Span<12ul, void>(unsigned short const (&) [12ul]) Line | Count | Source | 171 | 40.0k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
Unexecuted instantiation: bssl::Span<unsigned char, 18446744073709551615ul>::Span<8ul, void>(unsigned char (&) [8ul]) bssl::Span<unsigned short const, 18446744073709551615ul>::Span<3ul, void>(unsigned short const (&) [3ul]) Line | Count | Source | 171 | 111k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char, 18446744073709551615ul>::Span<1568ul, void>(unsigned char (&) [1568ul]) Line | Count | Source | 171 | 62.2k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char, 32ul>::Span<32ul, void>(unsigned char (&) [32ul]) Line | Count | Source | 171 | 56.4k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<8ul, void>(unsigned char const (&) [8ul]) Line | Count | Source | 171 | 36.4k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char const, 4ul>::Span<4ul, void>(unsigned char const (&) [4ul]) Line | Count | Source | 171 | 2.13k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char const, 6ul>::Span<6ul, void>(unsigned char const (&) [6ul]) Line | Count | Source | 171 | 7.17k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<2ul, void>(unsigned char const (&) [2ul]) Line | Count | Source | 171 | 33.3k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
Unexecuted instantiation: bssl::Span<ssl_cipher_st const, 18446744073709551615ul>::Span<24ul, void>(ssl_cipher_st const (&) [24ul]) Unexecuted instantiation: bssl::Span<ssl_cipher_st const, 24ul>::Span<24ul, void>(ssl_cipher_st const (&) [24ul]) Unexecuted instantiation: bssl::Span<bssl::NamedGroup const, 18446744073709551615ul>::Span<7ul, void>(bssl::NamedGroup const (&) [7ul]) bssl::Span<unsigned short const, 3ul>::Span<3ul, void>(unsigned short const (&) [3ul]) Line | Count | Source | 171 | 7.66k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
Unexecuted instantiation: bssl::Span<bssl::NamedGroup const, 7ul>::Span<7ul, void>(bssl::NamedGroup const (&) [7ul]) Unexecuted instantiation: bssl::Span<char const* const, 3ul>::Span<3ul, void>(char const* const (&) [3ul]) Unexecuted instantiation: bssl::Span<SignatureAlgorithmName const, 14ul>::Span<14ul, void>(SignatureAlgorithmName const (&) [14ul]) bssl::Span<unsigned char const, 18446744073709551615ul>::Span<4ul, void>(unsigned char const (&) [4ul]) Line | Count | Source | 171 | 26.7k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned short const, 18446744073709551615ul>::Span<4ul, void>(unsigned short const (&) [4ul]) Line | Count | Source | 171 | 374k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
Unexecuted instantiation: bssl::Span<bssl::VersionInfo const, 7ul>::Span<7ul, void>(bssl::VersionInfo const (&) [7ul]) bssl::Span<char const, 18446744073709551615ul>::Span<34ul, void>(char const (&) [34ul]) Line | Count | Source | 171 | 4.55k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<char const, 18446744073709551615ul>::Span<20ul, void>(char const (&) [20ul]) Line | Count | Source | 171 | 6 | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
Unexecuted instantiation: bssl::Span<unsigned char, 8ul>::Span<8ul, void>(unsigned char (&) [8ul]) bssl::Span<unsigned char const, 32ul>::Span<32ul, void>(unsigned char const (&) [32ul]) Line | Count | Source | 171 | 194 | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char, 80ul>::Span<80ul, void>(unsigned char (&) [80ul]) Line | Count | Source | 171 | 57.5k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char, 24ul>::Span<24ul, void>(unsigned char (&) [24ul]) Line | Count | Source | 171 | 57.5k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char, 18446744073709551615ul>::Span<2ul, void>(unsigned char (&) [2ul]) Line | Count | Source | 171 | 105k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char const, 9ul>::Span<9ul, void>(unsigned char const (&) [9ul]) Line | Count | Source | 171 | 4.75k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
Unexecuted instantiation: bssl::Span<evp_pkey_alg_st const* const, 18446744073709551615ul>::Span<4ul, void>(evp_pkey_alg_st const* const (&) [4ul]) Unexecuted instantiation: bssl::Span<unsigned char const, 18446744073709551615ul>::Span<54ul, void>(unsigned char const (&) [54ul]) bssl::Span<unsigned char const, 18446744073709551615ul>::Span<9ul, void>(unsigned char const (&) [9ul]) Line | Count | Source | 171 | 3.89k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
Unexecuted instantiation: bssl::Span<unsigned char const, 18446744073709551615ul>::Span<65ul, void>(unsigned char const (&) [65ul]) bssl::Span<unsigned char const, 18446744073709551615ul>::Span<3ul, void>(unsigned char const (&) [3ul]) Line | Count | Source | 171 | 6.44k | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<5ul, void>(unsigned char const (&) [5ul]) Line | Count | Source | 171 | 661 | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<7ul, void>(unsigned char const (&) [7ul]) Line | Count | Source | 171 | 576 | constexpr Span(T (&array)[NA]) : internal::SpanStorage<T, N>(array, NA) {} |
Unexecuted instantiation: bssl::Span<unsigned char const, 18446744073709551615ul>::Span<10ul, void>(unsigned char const (&) [10ul]) |
172 | | |
173 | | // TODO(crbug.com/457351017): Add tests for these c'tors. |
174 | | template <size_t NA, typename U, |
175 | | typename = internal::EnableIfContainer<std::array<U, NA>, T>, |
176 | | typename = std::enable_if_t<N == NA || N == dynamic_extent>> |
177 | | // NOLINTNEXTLINE(google-explicit-constructor): same as std::span. |
178 | | constexpr Span(std::array<U, NA> &array) |
179 | | : internal::SpanStorage<T, N>(array.data(), NA) {} |
180 | | |
181 | | template <size_t NA, typename U, |
182 | | typename = internal::EnableIfContainer<const std::array<U, NA>, T>, |
183 | | typename = std::enable_if_t<N == NA || N == dynamic_extent>> |
184 | | // NOLINTNEXTLINE(google-explicit-constructor): same as std::span. |
185 | | constexpr Span(const std::array<U, NA> &array) |
186 | 1.74k | : internal::SpanStorage<T, N>(array.data(), NA) {}bssl::Span<ec_group_st const* const, 18446744073709551615ul>::Span<4ul, ec_group_st const*, void, void>(std::__1::array<ec_group_st const*, 4ul> const&) Line | Count | Source | 186 | 1.74k | : internal::SpanStorage<T, N>(array.data(), NA) {} |
Unexecuted instantiation: bssl::Span<evp_pkey_alg_st const* const, 18446744073709551615ul>::Span<8ul, evp_pkey_alg_st const*, void, void>(std::__1::array<evp_pkey_alg_st const*, 8ul> const&) |
187 | | |
188 | | template < |
189 | | size_t NA, typename U, |
190 | | typename = std::enable_if_t<std::is_convertible_v<U (*)[], T (*)[]>>, |
191 | | typename = std::enable_if_t<N == dynamic_extent || N == NA>> |
192 | | // NOLINTNEXTLINE(google-explicit-constructor): same as std::span. |
193 | | constexpr Span(Span<U, NA> other) |
194 | 5.02M | : internal::SpanStorage<T, N>(other.data(), other.size()) {}bssl::Span<unsigned char const, 18446744073709551615ul>::Span<18446744073709551615ul, unsigned char, void, void>(bssl::Span<unsigned char, 18446744073709551615ul>) Line | Count | Source | 194 | 4.82M | : internal::SpanStorage<T, N>(other.data(), other.size()) {} |
Unexecuted instantiation: bssl::Span<unsigned char const, 18446744073709551615ul>::Span<65ul, unsigned char const, void, void>(bssl::Span<unsigned char const, 65ul>) bssl::Span<unsigned char const, 18446744073709551615ul>::Span<16ul, unsigned char const, void, void>(bssl::Span<unsigned char const, 16ul>) Line | Count | Source | 194 | 128 | : internal::SpanStorage<T, N>(other.data(), other.size()) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<8ul, unsigned char, void, void>(bssl::Span<unsigned char, 8ul>) Line | Count | Source | 194 | 26.0k | : internal::SpanStorage<T, N>(other.data(), other.size()) {} |
Unexecuted instantiation: bssl::Span<unsigned short const, 18446744073709551615ul>::Span<18446744073709551615ul, unsigned short, void, void>(bssl::Span<unsigned short, 18446744073709551615ul>) bssl::Span<unsigned short const, 18446744073709551615ul>::Span<3ul, unsigned short const, void, void>(bssl::Span<unsigned short const, 3ul>) Line | Count | Source | 194 | 7.66k | : internal::SpanStorage<T, N>(other.data(), other.size()) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<4ul, unsigned char const, void, void>(bssl::Span<unsigned char const, 4ul>) Line | Count | Source | 194 | 28.1k | : internal::SpanStorage<T, N>(other.data(), other.size()) {} |
bssl::Span<unsigned char, 18446744073709551615ul>::Span<8ul, unsigned char, void, void>(bssl::Span<unsigned char, 8ul>) Line | Count | Source | 194 | 194 | : internal::SpanStorage<T, N>(other.data(), other.size()) {} |
bssl::Span<ec_group_st const* const, 18446744073709551615ul>::Span<18446744073709551615ul, ec_group_st const*, void, void>(bssl::Span<ec_group_st const*, 18446744073709551615ul>) Line | Count | Source | 194 | 138k | : internal::SpanStorage<T, N>(other.data(), other.size()) {} |
Unexecuted instantiation: bssl::Span<evp_pkey_alg_st const* const, 18446744073709551615ul>::Span<18446744073709551615ul, evp_pkey_alg_st const*, void, void>(bssl::Span<evp_pkey_alg_st const*, 18446744073709551615ul>) |
195 | | |
196 | | template <typename C, typename = internal::EnableIfContainer<C, T>, |
197 | | typename = std::enable_if_t<std::is_const_v<T>, C>, |
198 | | typename = std::enable_if_t<N == dynamic_extent, C>> |
199 | | // NOLINTNEXTLINE(google-explicit-constructor): same as std::span. |
200 | | constexpr Span(const C &container) |
201 | 3.91M | : internal::SpanStorage<T, N>(container.data(), container.size()) {}bssl::Span<unsigned char const, 18446744073709551615ul>::Span<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, void, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >(std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Line | Count | Source | 201 | 6.37k | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<bssl::Array<unsigned char>, void, bssl::Array<unsigned char>, bssl::Array<unsigned char> >(bssl::Array<unsigned char> const&) Line | Count | Source | 201 | 1.78M | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
bssl::Span<unsigned short const, 18446744073709551615ul>::Span<bssl::Array<unsigned short>, void, bssl::Array<unsigned short>, bssl::Array<unsigned short> >(bssl::Array<unsigned short> const&) Line | Count | Source | 201 | 492k | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
Unexecuted instantiation: bssl::Span<unsigned short const, 18446744073709551615ul>::Span<bssl::InplaceVector<unsigned short, 7ul>, void, bssl::InplaceVector<unsigned short, 7ul>, bssl::InplaceVector<unsigned short, 7ul> >(bssl::InplaceVector<unsigned short, 7ul> const&) bssl::Span<unsigned short const, 18446744073709551615ul>::Span<bssl::InplaceVector<unsigned short, 2ul>, void, bssl::InplaceVector<unsigned short, 2ul>, bssl::InplaceVector<unsigned short, 2ul> >(bssl::InplaceVector<unsigned short, 2ul> const&) Line | Count | Source | 201 | 62.2k | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<bssl::InplaceVector<unsigned char, 48ul>, void, bssl::InplaceVector<unsigned char, 48ul>, bssl::InplaceVector<unsigned char, 48ul> >(bssl::InplaceVector<unsigned char, 48ul> const&) Line | Count | Source | 201 | 403k | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
bssl::Span<unsigned char const, 18446744073709551615ul>::Span<bssl::InplaceVector<unsigned char, 32ul>, void, bssl::InplaceVector<unsigned char, 32ul>, bssl::InplaceVector<unsigned char, 32ul> >(bssl::InplaceVector<unsigned char, 32ul> const&) Line | Count | Source | 201 | 810k | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
bssl::Span<bool const, 18446744073709551615ul>::Span<bssl::Array<bool>, void, bssl::Array<bool>, bssl::Array<bool> >(bssl::Array<bool> const&) Line | Count | Source | 201 | 16.2k | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
Unexecuted instantiation: bssl::Span<unsigned char const, 18446744073709551615ul>::Span<bssl::InplaceVector<unsigned char, 12ul>, void, bssl::InplaceVector<unsigned char, 12ul>, bssl::InplaceVector<unsigned char, 12ul> >(bssl::InplaceVector<unsigned char, 12ul> const&) bssl::Span<unsigned char const, 18446744073709551615ul>::Span<bssl::der::Input, void, bssl::der::Input, bssl::der::Input>(bssl::der::Input const&) Line | Count | Source | 201 | 337k | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
|
202 | | |
203 | | // NOTE: This constructor may abort() at runtime if the container's length |
204 | | // differs from the compile-time size, if any. |
205 | | template <typename C, typename = internal::EnableIfContainer<C, T>, |
206 | | typename = std::enable_if_t<std::is_const_v<T>, C>, |
207 | | typename = std::enable_if_t<N != dynamic_extent, C>> |
208 | | constexpr explicit Span(const C &container, |
209 | | internal::AllowRedeclaringConstructor = {}) |
210 | | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
211 | | |
212 | | // NOTE: This constructor may abort() at runtime if the container's length |
213 | | // differs from the compile-time size, if any. |
214 | | template <typename C, typename = internal::EnableIfContainer<C, T>, |
215 | | typename = std::enable_if_t<!std::is_const_v<T>, C>> |
216 | | constexpr explicit Span(C &container) |
217 | 282k | : internal::SpanStorage<T, N>(container.data(), container.size()) {}bssl::Span<unsigned char, 18446744073709551615ul>::Span<bssl::Array<unsigned char>, void, bssl::Array<unsigned char> >(bssl::Array<unsigned char>&) Line | Count | Source | 217 | 147k | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
bssl::Span<unsigned char, 18446744073709551615ul>::Span<bssl::InplaceVector<unsigned char, 48ul>, void, bssl::InplaceVector<unsigned char, 48ul> >(bssl::InplaceVector<unsigned char, 48ul>&) Line | Count | Source | 217 | 134k | : internal::SpanStorage<T, N>(container.data(), container.size()) {} |
|
218 | | |
219 | | using internal::SpanStorage<T, N>::data; |
220 | | using internal::SpanStorage<T, N>::size; |
221 | 12.0M | constexpr bool empty() const { return size() == 0; }bssl::Span<unsigned char const, 18446744073709551615ul>::empty() const Line | Count | Source | 221 | 10.2M | constexpr bool empty() const { return size() == 0; } |
Unexecuted instantiation: bssl::Span<char const*, 18446744073709551615ul>::empty() const bssl::Span<unsigned short const, 18446744073709551615ul>::empty() const Line | Count | Source | 221 | 109k | constexpr bool empty() const { return size() == 0; } |
bssl::Span<unsigned char, 18446744073709551615ul>::empty() const Line | Count | Source | 221 | 1.67M | constexpr bool empty() const { return size() == 0; } |
bssl::Span<int const, 18446744073709551615ul>::empty() const Line | Count | Source | 221 | 5.89k | constexpr bool empty() const { return size() == 0; } |
|
222 | | |
223 | 7.32M | constexpr iterator begin() const { return data(); }bssl::Span<unsigned char const, 18446744073709551615ul>::begin() const Line | Count | Source | 223 | 5.66M | constexpr iterator begin() const { return data(); } |
bssl::Span<unsigned short const, 18446744073709551615ul>::begin() const Line | Count | Source | 223 | 1.26M | constexpr iterator begin() const { return data(); } |
Unexecuted instantiation: bssl::Span<ssl_cipher_st const, 18446744073709551615ul>::begin() const Unexecuted instantiation: bssl::Span<bssl::NamedGroup const, 18446744073709551615ul>::begin() const bssl::Span<bool const, 18446744073709551615ul>::begin() const Line | Count | Source | 223 | 16.2k | constexpr iterator begin() const { return data(); } |
bssl::Span<ec_group_st const* const, 18446744073709551615ul>::begin() const Line | Count | Source | 223 | 120k | constexpr iterator begin() const { return data(); } |
bssl::Span<evp_pkey_alg_st const* const, 18446744073709551615ul>::begin() const Line | Count | Source | 223 | 255k | constexpr iterator begin() const { return data(); } |
|
224 | | constexpr const_iterator cbegin() const { return data(); } |
225 | 7.51M | constexpr iterator end() const { return data() + size(); }bssl::Span<unsigned char const, 18446744073709551615ul>::end() const Line | Count | Source | 225 | 5.66M | constexpr iterator end() const { return data() + size(); } |
bssl::Span<unsigned short const, 18446744073709551615ul>::end() const Line | Count | Source | 225 | 1.45M | constexpr iterator end() const { return data() + size(); } |
Unexecuted instantiation: bssl::Span<ssl_cipher_st const, 18446744073709551615ul>::end() const Unexecuted instantiation: bssl::Span<bssl::NamedGroup const, 18446744073709551615ul>::end() const bssl::Span<bool const, 18446744073709551615ul>::end() const Line | Count | Source | 225 | 16.2k | constexpr iterator end() const { return data() + size(); } |
bssl::Span<ec_group_st const* const, 18446744073709551615ul>::end() const Line | Count | Source | 225 | 120k | constexpr iterator end() const { return data() + size(); } |
bssl::Span<evp_pkey_alg_st const* const, 18446744073709551615ul>::end() const Line | Count | Source | 225 | 255k | constexpr iterator end() const { return data() + size(); } |
|
226 | | constexpr const_iterator cend() const { return end(); } |
227 | | |
228 | 4.33k | constexpr T &front() const { |
229 | 4.33k | BSSL_CHECK(size() != 0); |
230 | 4.33k | return data()[0]; |
231 | 4.33k | } |
232 | 120k | constexpr T &back() const { |
233 | 120k | BSSL_CHECK(size() != 0); |
234 | 120k | return data()[size() - 1]; |
235 | 120k | } bssl::Span<unsigned char const, 18446744073709551615ul>::back() const Line | Count | Source | 232 | 7.09k | constexpr T &back() const { | 233 | 7.09k | BSSL_CHECK(size() != 0); | 234 | 7.09k | return data()[size() - 1]; | 235 | 7.09k | } |
bssl::Span<unsigned char, 18446744073709551615ul>::back() const Line | Count | Source | 232 | 113k | constexpr T &back() const { | 233 | 113k | BSSL_CHECK(size() != 0); | 234 | 113k | return data()[size() - 1]; | 235 | 113k | } |
|
236 | | |
237 | 1.31M | constexpr T &operator[](size_t i) const { |
238 | 1.31M | BSSL_CHECK(i < size()); |
239 | 1.31M | return data()[i]; |
240 | 1.31M | } bssl::Span<unsigned char const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 237 | 527k | constexpr T &operator[](size_t i) const { | 238 | 527k | BSSL_CHECK(i < size()); | 239 | 527k | return data()[i]; | 240 | 527k | } |
Unexecuted instantiation: bssl::Span<char const*, 18446744073709551615ul>::operator[](unsigned long) const bssl::Span<unsigned short const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 237 | 327k | constexpr T &operator[](size_t i) const { | 238 | 327k | BSSL_CHECK(i < size()); | 239 | 327k | return data()[i]; | 240 | 327k | } |
bssl::Span<unsigned char, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 237 | 451k | constexpr T &operator[](size_t i) const { | 238 | 451k | BSSL_CHECK(i < size()); | 239 | 451k | return data()[i]; | 240 | 451k | } |
Unexecuted instantiation: bssl::Span<char const* const, 18446744073709551615ul>::operator[](unsigned long) const Unexecuted instantiation: bssl::Span<ssl_cipher_st const, 24ul>::operator[](unsigned long) const Unexecuted instantiation: bssl::Span<bssl::NamedGroup const, 7ul>::operator[](unsigned long) const bssl::Span<int const, 18446744073709551615ul>::operator[](unsigned long) const Line | Count | Source | 237 | 5.92k | constexpr T &operator[](size_t i) const { | 238 | 5.92k | BSSL_CHECK(i < size()); | 239 | 5.92k | return data()[i]; | 240 | 5.92k | } |
Unexecuted instantiation: bssl::Span<char const* const, 3ul>::operator[](unsigned long) const Unexecuted instantiation: bssl::Span<SignatureAlgorithmName const, 14ul>::operator[](unsigned long) const Unexecuted instantiation: bssl::Span<bssl::VersionInfo const, 7ul>::operator[](unsigned long) const |
241 | | T &at(size_t i) const { return (*this)[i]; } |
242 | | |
243 | | private: |
244 | 28.3k | static constexpr size_t SubspanOutLen(size_t size, size_t pos, size_t len) { |
245 | 28.3k | return len != dynamic_extent ? len : size - pos; |
246 | 28.3k | } |
247 | | static constexpr size_t SubspanTypeOutLen(size_t size, size_t pos, |
248 | 0 | size_t len) { |
249 | 0 | // This differs from SubspanOutLen in that if both size and len are |
250 | 0 | // dynamic_extent, dynamic_extent will be returned. |
251 | 0 | return len != dynamic_extent |
252 | 0 | ? len |
253 | 0 | : (size != dynamic_extent ? size - pos : dynamic_extent); |
254 | 0 | } Unexecuted instantiation: bssl::Span<unsigned char const, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<char const*, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned short const, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char const, 65ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char const, 16ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<ssl_cipher_st const, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<bssl::NamedGroup const, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char, 32ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char, 8ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char const, 4ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char const, 6ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<bool const, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<char const* const, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<ssl_cipher_st const, 24ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned short, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned short const, 3ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<bssl::NamedGroup const, 7ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<int const, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<char const* const, 3ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<SignatureAlgorithmName const, 14ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<bssl::VersionInfo const, 7ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<char const, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char const, 32ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char, 80ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char, 24ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<unsigned char const, 9ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<ec_group_st const* const, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<ec_group_st const*, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<evp_pkey_alg_st const* const, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: bssl::Span<evp_pkey_alg_st const*, 18446744073709551615ul>::SubspanTypeOutLen(unsigned long, unsigned long, unsigned long) |
255 | | |
256 | | public: |
257 | | // NOTE: This method may abort() at runtime if pos or len are out of range. |
258 | | // NOTE: As opposed to std::span, the |dynamic_extent| value of |len| is not |
259 | | // magical here. This gets rid of a lot of runtime checks. |
260 | 603k | constexpr Span<T> subspan(size_t pos, size_t len) const { |
261 | | // absl::Span throws an exception here. Note std::span and Chromium |
262 | | // base::span forbid pos + len being out of range, with a special case at |
263 | | // npos/dynamic_extent, whereas absl::Span::subspan clips the span. This |
264 | | // implements the std::span behavior which is more strict. |
265 | 603k | BSSL_CHECK(pos <= size()); |
266 | 603k | BSSL_CHECK(len <= size() - pos); |
267 | 603k | return Span<T>(data() + pos, len); |
268 | 603k | } bssl::Span<unsigned char const, 18446744073709551615ul>::subspan(unsigned long, unsigned long) const Line | Count | Source | 260 | 341k | constexpr Span<T> subspan(size_t pos, size_t len) const { | 261 | | // absl::Span throws an exception here. Note std::span and Chromium | 262 | | // base::span forbid pos + len being out of range, with a special case at | 263 | | // npos/dynamic_extent, whereas absl::Span::subspan clips the span. This | 264 | | // implements the std::span behavior which is more strict. | 265 | 341k | BSSL_CHECK(pos <= size()); | 266 | 341k | BSSL_CHECK(len <= size() - pos); | 267 | 341k | return Span<T>(data() + pos, len); | 268 | 341k | } |
bssl::Span<unsigned char, 18446744073709551615ul>::subspan(unsigned long, unsigned long) const Line | Count | Source | 260 | 262k | constexpr Span<T> subspan(size_t pos, size_t len) const { | 261 | | // absl::Span throws an exception here. Note std::span and Chromium | 262 | | // base::span forbid pos + len being out of range, with a special case at | 263 | | // npos/dynamic_extent, whereas absl::Span::subspan clips the span. This | 264 | | // implements the std::span behavior which is more strict. | 265 | 262k | BSSL_CHECK(pos <= size()); | 266 | 262k | BSSL_CHECK(len <= size() - pos); | 267 | 262k | return Span<T>(data() + pos, len); | 268 | 262k | } |
|
269 | | |
270 | | // NOTE: This method may abort() at runtime if pos is out of range. |
271 | 2.91M | constexpr Span<T> subspan(size_t pos) const { |
272 | | // absl::Span throws an exception here. |
273 | 2.91M | BSSL_CHECK(pos <= size()); |
274 | 2.91M | return Span<T>(data() + pos, size() - pos); |
275 | 2.91M | } bssl::Span<unsigned char const, 18446744073709551615ul>::subspan(unsigned long) const Line | Count | Source | 271 | 2.75M | constexpr Span<T> subspan(size_t pos) const { | 272 | | // absl::Span throws an exception here. | 273 | 2.75M | BSSL_CHECK(pos <= size()); | 274 | 2.75M | return Span<T>(data() + pos, size() - pos); | 275 | 2.75M | } |
Unexecuted instantiation: bssl::Span<char const*, 18446744073709551615ul>::subspan(unsigned long) const bssl::Span<unsigned char, 18446744073709551615ul>::subspan(unsigned long) const Line | Count | Source | 271 | 163k | constexpr Span<T> subspan(size_t pos) const { | 272 | | // absl::Span throws an exception here. | 273 | 163k | BSSL_CHECK(pos <= size()); | 274 | 163k | return Span<T>(data() + pos, size() - pos); | 275 | 163k | } |
bssl::Span<unsigned char, 32ul>::subspan(unsigned long) const Line | Count | Source | 271 | 1.36k | constexpr Span<T> subspan(size_t pos) const { | 272 | | // absl::Span throws an exception here. | 273 | 1.36k | BSSL_CHECK(pos <= size()); | 274 | 1.36k | return Span<T>(data() + pos, size() - pos); | 275 | 1.36k | } |
|
276 | | |
277 | | // NOTE: This method may abort() at runtime if len is out of range. |
278 | | template <size_t pos, size_t len = dynamic_extent> |
279 | 28.3k | constexpr Span<T, SubspanTypeOutLen(N, pos, len)> subspan() const { |
280 | | // absl::Span throws an exception here. Note std::span and Chromium |
281 | | // base::span forbid pos + len being out of range, with a special case at |
282 | | // npos/dynamic_extent, whereas absl::Span::subspan clips the span. This |
283 | | // implements the std::span behavior which is more strict. |
284 | 28.3k | BSSL_CHECK(pos <= size()); |
285 | 28.3k | BSSL_CHECK(len == dynamic_extent || len <= size() - pos); |
286 | 28.3k | return Span<T, SubspanTypeOutLen(N, pos, len)>( |
287 | 28.3k | data() + pos, SubspanOutLen(size(), pos, len)); |
288 | 28.3k | } Unexecuted instantiation: bssl::Span<unsigned char const, bssl::Span<unsigned char const, 18446744073709551615ul>::SubspanTypeOutLen(18446744073709551615ul, 16ul, 16ul)> bssl::Span<unsigned char const, 18446744073709551615ul>::subspan<16ul, 16ul>() const bssl::Span<unsigned char const, bssl::Span<unsigned char const, 18446744073709551615ul>::SubspanTypeOutLen(18446744073709551615ul, 12ul, 18446744073709551615ul)> bssl::Span<unsigned char const, 18446744073709551615ul>::subspan<12ul, 18446744073709551615ul>() const Line | Count | Source | 279 | 28.3k | constexpr Span<T, SubspanTypeOutLen(N, pos, len)> subspan() const { | 280 | | // absl::Span throws an exception here. Note std::span and Chromium | 281 | | // base::span forbid pos + len being out of range, with a special case at | 282 | | // npos/dynamic_extent, whereas absl::Span::subspan clips the span. This | 283 | | // implements the std::span behavior which is more strict. | 284 | 28.3k | BSSL_CHECK(pos <= size()); | 285 | 28.3k | BSSL_CHECK(len == dynamic_extent || len <= size() - pos); | 286 | 28.3k | return Span<T, SubspanTypeOutLen(N, pos, len)>( | 287 | 28.3k | data() + pos, SubspanOutLen(size(), pos, len)); | 288 | 28.3k | } |
Unexecuted instantiation: bssl::Span<unsigned char const, bssl::Span<unsigned char const, 18446744073709551615ul>::SubspanTypeOutLen(18446744073709551615ul, 4ul, 18446744073709551615ul)> bssl::Span<unsigned char const, 18446744073709551615ul>::subspan<4ul, 18446744073709551615ul>() const |
289 | | |
290 | | // NOTE: This method may abort() at runtime if len is out of range. |
291 | 1.01M | constexpr Span<T> first(size_t len) const { |
292 | 1.01M | BSSL_CHECK(len <= size()); |
293 | 1.01M | return Span<T>(data(), len); |
294 | 1.01M | } bssl::Span<unsigned char const, 18446744073709551615ul>::first(unsigned long) const Line | Count | Source | 291 | 245k | constexpr Span<T> first(size_t len) const { | 292 | 245k | BSSL_CHECK(len <= size()); | 293 | 245k | return Span<T>(data(), len); | 294 | 245k | } |
Unexecuted instantiation: bssl::Span<char const*, 18446744073709551615ul>::first(unsigned long) const bssl::Span<unsigned char, 80ul>::first(unsigned long) const Line | Count | Source | 291 | 57.5k | constexpr Span<T> first(size_t len) const { | 292 | 57.5k | BSSL_CHECK(len <= size()); | 293 | 57.5k | return Span<T>(data(), len); | 294 | 57.5k | } |
bssl::Span<unsigned char, 24ul>::first(unsigned long) const Line | Count | Source | 291 | 57.5k | constexpr Span<T> first(size_t len) const { | 292 | 57.5k | BSSL_CHECK(len <= size()); | 293 | 57.5k | return Span<T>(data(), len); | 294 | 57.5k | } |
bssl::Span<unsigned char, 32ul>::first(unsigned long) const Line | Count | Source | 291 | 46.4k | constexpr Span<T> first(size_t len) const { | 292 | 46.4k | BSSL_CHECK(len <= size()); | 293 | 46.4k | return Span<T>(data(), len); | 294 | 46.4k | } |
bssl::Span<unsigned char, 18446744073709551615ul>::first(unsigned long) const Line | Count | Source | 291 | 606k | constexpr Span<T> first(size_t len) const { | 292 | 606k | BSSL_CHECK(len <= size()); | 293 | 606k | return Span<T>(data(), len); | 294 | 606k | } |
bssl::Span<unsigned char const, 9ul>::first(unsigned long) const Line | Count | Source | 291 | 4.75k | constexpr Span<T> first(size_t len) const { | 292 | 4.75k | BSSL_CHECK(len <= size()); | 293 | 4.75k | return Span<T>(data(), len); | 294 | 4.75k | } |
|
295 | | |
296 | | // NOTE: This method may abort() at runtime if len is out of range. |
297 | | template <size_t len> |
298 | 28.6k | constexpr Span<T, len> first() const { |
299 | 28.6k | BSSL_CHECK(len <= size()); |
300 | 28.6k | return Span<T, len>(data(), len); |
301 | 28.6k | } Unexecuted instantiation: bssl::Span<unsigned char const, 65ul> bssl::Span<unsigned char const, 18446744073709551615ul>::first<65ul>() const bssl::Span<unsigned char const, 16ul> bssl::Span<unsigned char const, 18446744073709551615ul>::first<16ul>() const Line | Count | Source | 298 | 128 | constexpr Span<T, len> first() const { | 299 | 128 | BSSL_CHECK(len <= size()); | 300 | 128 | return Span<T, len>(data(), len); | 301 | 128 | } |
bssl::Span<unsigned char const, 4ul> bssl::Span<unsigned char const, 18446744073709551615ul>::first<4ul>() const Line | Count | Source | 298 | 28.5k | constexpr Span<T, len> first() const { | 299 | 28.5k | BSSL_CHECK(len <= size()); | 300 | 28.5k | return Span<T, len>(data(), len); | 301 | 28.5k | } |
bssl::Span<unsigned char, 8ul> bssl::Span<unsigned char, 18446744073709551615ul>::first<8ul>() const Line | Count | Source | 298 | 41 | constexpr Span<T, len> first() const { | 299 | 41 | BSSL_CHECK(len <= size()); | 300 | 41 | return Span<T, len>(data(), len); | 301 | 41 | } |
|
302 | | |
303 | | // NOTE: This method may abort() at runtime if len is out of range. |
304 | 17.2k | constexpr Span<T> last(size_t len) const { |
305 | 17.2k | BSSL_CHECK(len <= size()); |
306 | 17.2k | return Span<T>(data() + size() - len, len); |
307 | 17.2k | } bssl::Span<unsigned char, 18446744073709551615ul>::last(unsigned long) const Line | Count | Source | 304 | 7.97k | constexpr Span<T> last(size_t len) const { | 305 | 7.97k | BSSL_CHECK(len <= size()); | 306 | 7.97k | return Span<T>(data() + size() - len, len); | 307 | 7.97k | } |
Unexecuted instantiation: bssl::Span<unsigned char const, 18446744073709551615ul>::last(unsigned long) const bssl::Span<unsigned char const, 4ul>::last(unsigned long) const Line | Count | Source | 304 | 2.13k | constexpr Span<T> last(size_t len) const { | 305 | 2.13k | BSSL_CHECK(len <= size()); | 306 | 2.13k | return Span<T>(data() + size() - len, len); | 307 | 2.13k | } |
bssl::Span<unsigned char const, 6ul>::last(unsigned long) const Line | Count | Source | 304 | 7.17k | constexpr Span<T> last(size_t len) const { | 305 | 7.17k | BSSL_CHECK(len <= size()); | 306 | 7.17k | return Span<T>(data() + size() - len, len); | 307 | 7.17k | } |
Unexecuted instantiation: bssl::Span<unsigned char const, 18446744073709551615ul>::last(unsigned long) const |
308 | | |
309 | | // NOTE: This method may abort() at runtime if len is out of range. |
310 | | template <size_t len> |
311 | 8.89k | constexpr Span<T, len> last() const { |
312 | 8.89k | BSSL_CHECK(len <= size()); |
313 | 8.89k | return Span<T, len>(data() + size() - len, len); |
314 | 8.89k | } bssl::Span<unsigned char, 8ul> bssl::Span<unsigned char, 32ul>::last<8ul>() const Line | Count | Source | 311 | 8.70k | constexpr Span<T, len> last() const { | 312 | 8.70k | BSSL_CHECK(len <= size()); | 313 | 8.70k | return Span<T, len>(data() + size() - len, len); | 314 | 8.70k | } |
bssl::Span<unsigned char, 8ul> bssl::Span<unsigned char, 18446744073709551615ul>::last<8ul>() const Line | Count | Source | 311 | 194 | constexpr Span<T, len> last() const { | 312 | 194 | BSSL_CHECK(len <= size()); | 313 | 194 | return Span<T, len>(data() + size() - len, len); | 314 | 194 | } |
|
315 | | }; |
316 | | |
317 | | template <typename T> |
318 | | Span(T *, size_t) -> Span<T>; |
319 | | template <typename T, size_t size> |
320 | | Span(T (&array)[size]) -> Span<T, size>; |
321 | | template <typename T, size_t size> |
322 | | Span(std::array<T, size> &array) -> Span<T, size>; |
323 | | template <typename T, size_t size> |
324 | | Span(const std::array<T, size> &array) -> Span<const T, size>; |
325 | | template < |
326 | | typename C, |
327 | | typename T = std::remove_pointer_t<decltype(std::declval<C>().data())>, |
328 | | typename = internal::EnableIfContainer<C, T>> |
329 | | Span(C &) -> Span<T>; |
330 | | |
331 | | template <typename T> |
332 | | constexpr Span<T> MakeSpan(T *ptr, size_t size) { |
333 | | return Span<T>(ptr, size); |
334 | | } |
335 | | |
336 | | template <typename C> |
337 | | constexpr auto MakeSpan(C &c) -> decltype(MakeSpan(c.data(), c.size())) { |
338 | | return MakeSpan(c.data(), c.size()); |
339 | | } |
340 | | |
341 | | template <typename T, size_t N> |
342 | | constexpr Span<T, N> MakeSpan(T (&array)[N]) { |
343 | | return array; |
344 | | } |
345 | | |
346 | | template <typename T> |
347 | 65.1k | constexpr Span<const T> MakeConstSpan(T *ptr, size_t size) { |
348 | 65.1k | return Span<const T>(ptr, size); |
349 | 65.1k | } bssl::Span<unsigned char const, 18446744073709551615ul> bssl::MakeConstSpan<unsigned char const>(unsigned char const*, unsigned long) Line | Count | Source | 347 | 65.1k | constexpr Span<const T> MakeConstSpan(T *ptr, size_t size) { | 348 | 65.1k | return Span<const T>(ptr, size); | 349 | 65.1k | } |
Unexecuted instantiation: bssl::Span<unsigned char const, 18446744073709551615ul> bssl::MakeConstSpan<unsigned char>(unsigned char*, unsigned long) |
350 | | |
351 | | template <typename C> |
352 | | constexpr auto MakeConstSpan(const C &c) |
353 | | -> decltype(MakeConstSpan(c.data(), c.size())) { |
354 | | return MakeConstSpan(c.data(), c.size()); |
355 | | } |
356 | | |
357 | | template <typename T, size_t size> |
358 | | constexpr Span<const T, size> MakeConstSpan(T (&array)[size]) { |
359 | | return array; |
360 | | } |
361 | | |
362 | 65.1k | inline Span<const uint8_t> StringAsBytes(std::string_view s) { |
363 | 65.1k | return MakeConstSpan(reinterpret_cast<const uint8_t *>(s.data()), s.size()); |
364 | 65.1k | } |
365 | | |
366 | 304k | inline std::string_view BytesAsStringView(bssl::Span<const uint8_t> b) { |
367 | 304k | return std::string_view(reinterpret_cast<const char *>(b.data()), b.size()); |
368 | 304k | } |
369 | | |
370 | | BSSL_NAMESPACE_END |
371 | | |
372 | | } // extern C++ |
373 | | |
374 | | #endif // !defined(BORINGSSL_NO_CXX) |
375 | | |
376 | | #endif // OPENSSL_HEADER_SSL_SPAN_H |