Coverage Report

Created: 2026-10-13 06:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/botan/build/include/public/botan/concepts.h
Line
Count
Source
1
/**
2
 * Useful concepts that are available throughout the library
3
 * (C) 2023 Jack Lloyd
4
 *     2023 René Meusel - Rohde & Schwarz Cybersecurity
5
 *
6
 * Botan is released under the Simplified BSD License (see license.txt)
7
 */
8
9
#ifndef BOTAN_CONCEPTS_H_
10
#define BOTAN_CONCEPTS_H_
11
12
#include <botan/exceptn.h>
13
14
#include <concepts>
15
#include <cstdint>
16
#include <iosfwd>
17
#include <ranges>
18
#include <span>
19
#include <type_traits>
20
21
namespace Botan {
22
23
template <typename T, typename Tag, typename... Capabilities>
24
class Strong;
25
26
template <typename... Ts>
27
struct is_strong_type : std::false_type {};
28
29
template <typename... Ts>
30
struct is_strong_type<Strong<Ts...>> : std::true_type {};
31
32
template <typename... Ts>
33
constexpr bool is_strong_type_v = is_strong_type<std::remove_const_t<Ts>...>::value;
34
35
template <typename T0 = void, typename... Ts>
36
struct all_same {
37
      static constexpr bool value = (std::is_same_v<T0, Ts> && ... && true);
38
};
39
40
template <typename... Ts>
41
static constexpr bool all_same_v = all_same<Ts...>::value;
42
43
namespace detail {
44
45
/**
46
 * Helper type to indicate that a certain type should be automatically
47
 * detected based on the context.
48
 */
49
struct AutoDetect {
50
      constexpr AutoDetect() = delete;
51
};
52
53
}  // namespace detail
54
55
namespace ranges {
56
57
/**
58
 * Models a std::ranges::contiguous_range that (optionally) restricts its
59
 * value_type to ValueT. In other words: a stretch of contiguous memory of
60
 * a certain type (optional ValueT).
61
 */
62
template <typename T, typename ValueT = std::ranges::range_value_t<T>>
63
concept contiguous_range = std::ranges::contiguous_range<T> && std::same_as<ValueT, std::ranges::range_value_t<T>>;
64
65
/**
66
 * Models a std::ranges::contiguous_range that satisfies
67
 * std::ranges::output_range with an arbitrary value_type. In other words: a
68
 * stretch of contiguous memory of a certain type (optional ValueT) that can be
69
 * written to.
70
 */
71
template <typename T, typename ValueT = std::ranges::range_value_t<T>>
72
concept contiguous_output_range = contiguous_range<T, ValueT> && std::ranges::output_range<T, ValueT>;
73
74
/**
75
 * Models a range that can be turned into a std::span<>. Typically, this is some
76
 * form of ranges::contiguous_range.
77
 */
78
template <typename T>
79
concept spanable_range = std::constructible_from<std::span<const std::ranges::range_value_t<T>>, T>;
80
81
/**
82
 * Models a range that can be turned into a std::span<> with a static extent.
83
 * Typically, this is a std::array or a std::span derived from an array.
84
 */
85
// clang-format off
86
template <typename T>
87
concept statically_spanable_range = spanable_range<T> &&
88
                                    decltype(std::span{std::declval<T&>()})::extent != std::dynamic_extent;
89
90
// clang-format on
91
92
/**
93
 * Find the length in bytes of a given contiguous range @p r.
94
 */
95
596k
inline constexpr size_t size_bytes(spanable_range auto&& r) {
96
596k
   return std::span{r}.size_bytes();
97
596k
}
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__15arrayImLm4EEEEEmOT_
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm32EEEEEmOT_
Line
Count
Source
95
1.08k
inline constexpr size_t size_bytes(spanable_range auto&& r) {
96
1.08k
   return std::span{r}.size_bytes();
97
1.08k
}
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanImLm18446744073709551615EEEEEmOT_
Line
Count
Source
95
54.8k
inline constexpr size_t size_bytes(spanable_range auto&& r) {
96
54.8k
   return std::span{r}.size_bytes();
97
54.8k
}
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm18446744073709551615EEEEEmOT_
Line
Count
Source
95
20.5k
inline constexpr size_t size_bytes(spanable_range auto&& r) {
96
20.5k
   return std::span{r}.size_bytes();
97
20.5k
}
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanImLm1EEEEEmOT_
Line
Count
Source
95
150k
inline constexpr size_t size_bytes(spanable_range auto&& r) {
96
150k
   return std::span{r}.size_bytes();
97
150k
}
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm8EEEEEmOT_
Line
Count
Source
95
187k
inline constexpr size_t size_bytes(spanable_range auto&& r) {
96
187k
   return std::span{r}.size_bytes();
97
187k
}
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIjLm18446744073709551615EEEEEmOT_
Line
Count
Source
95
44.8k
inline constexpr size_t size_bytes(spanable_range auto&& r) {
96
44.8k
   return std::span{r}.size_bytes();
97
44.8k
}
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIjLm1EEEEEmOT_
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm4EEEEEmOT_
Line
Count
Source
95
72.9k
inline constexpr size_t size_bytes(spanable_range auto&& r) {
96
72.9k
   return std::span{r}.size_bytes();
97
72.9k
}
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm2EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__15arrayIjLm16EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanItLm1EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__15arrayIhLm16EEEEEmOT_
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanImLm4EEEEEmOT_
Line
Count
Source
95
18.4k
inline constexpr size_t size_bytes(spanable_range auto&& r) {
96
18.4k
   return std::span{r}.size_bytes();
97
18.4k
}
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanImLm6EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm48EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__15arrayImLm6EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanImLm8EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm64EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__15arrayImLm8EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanImLm9EEEEEmOT_
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__15arrayImLm18EEEEEmOT_
Line
Count
Source
95
45.9k
inline constexpr size_t size_bytes(spanable_range auto&& r) {
96
45.9k
   return std::span{r}.size_bytes();
97
45.9k
}
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanImLm3EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm24EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__15arrayImLm3EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm28EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm72EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm66EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__14spanIhLm98EEEEEmOT_
Unexecuted instantiation: _ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeERNSt3__15arrayImLm9EEEEEmOT_
98
99
/**
100
 * Check that a given range @p r has a certain statically-known byte length. If
101
 * the range's extent is known at compile time, this is a static check,
102
 * otherwise a runtime argument check will be added.
103
 *
104
 * @throws Invalid_Argument  if range @p r has a dynamic extent and does not
105
 *                           feature the expected byte length.
106
 */
107
template <size_t expected, spanable_range R>
108
1.01M
inline constexpr void assert_exact_byte_length(R&& r) {
109
1.01M
   const std::span s{r};
110
1.01M
   if constexpr(statically_spanable_range<R>) {
111
1.01M
      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
112
1.01M
   } else {
113
0
      if(s.size_bytes() != expected) {
114
0
         throw Invalid_Argument("Memory regions did not have expected byte lengths");
115
0
      }
116
0
   }
117
1.01M
}
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm32ETkNS0_14spanable_rangeERNSt3__14spanIhLm32EEEEEvOT0_
_ZN5Botan6ranges24assert_exact_byte_lengthILm32ETkNS0_14spanable_rangeERNSt3__14spanIKhLm32EEEEEvOT0_
Line
Count
Source
108
543
inline constexpr void assert_exact_byte_length(R&& r) {
109
543
   const std::span s{r};
110
543
   if constexpr(statically_spanable_range<R>) {
111
543
      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
112
   } else {
113
      if(s.size_bytes() != expected) {
114
         throw Invalid_Argument("Memory regions did not have expected byte lengths");
115
      }
116
   }
117
543
}
_ZN5Botan6ranges24assert_exact_byte_lengthILm32ETkNS0_14spanable_rangeERNSt3__15arrayImLm4EEEEEvOT0_
Line
Count
Source
108
18.1k
inline constexpr void assert_exact_byte_length(R&& r) {
109
18.1k
   const std::span s{r};
110
18.1k
   if constexpr(statically_spanable_range<R>) {
111
18.1k
      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
112
   } else {
113
      if(s.size_bytes() != expected) {
114
         throw Invalid_Argument("Memory regions did not have expected byte lengths");
115
      }
116
   }
117
18.1k
}
_ZN5Botan6ranges24assert_exact_byte_lengthILm8ETkNS0_14spanable_rangeERNSt3__14spanIKhLm8EEEEEvOT0_
Line
Count
Source
108
300k
inline constexpr void assert_exact_byte_length(R&& r) {
109
300k
   const std::span s{r};
110
300k
   if constexpr(statically_spanable_range<R>) {
111
300k
      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
112
   } else {
113
      if(s.size_bytes() != expected) {
114
         throw Invalid_Argument("Memory regions did not have expected byte lengths");
115
      }
116
   }
117
300k
}
_ZN5Botan6ranges24assert_exact_byte_lengthILm8ETkNS0_14spanable_rangeERNSt3__14spanIhLm8EEEEEvOT0_
Line
Count
Source
108
282k
inline constexpr void assert_exact_byte_length(R&& r) {
109
282k
   const std::span s{r};
110
282k
   if constexpr(statically_spanable_range<R>) {
111
282k
      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
112
   } else {
113
      if(s.size_bytes() != expected) {
114
         throw Invalid_Argument("Memory regions did not have expected byte lengths");
115
      }
116
   }
117
282k
}
_ZN5Botan6ranges24assert_exact_byte_lengthILm8ETkNS0_14spanable_rangeERNSt3__14spanIKmLm1EEEEEvOT0_
Line
Count
Source
108
187k
inline constexpr void assert_exact_byte_length(R&& r) {
109
187k
   const std::span s{r};
110
187k
   if constexpr(statically_spanable_range<R>) {
111
187k
      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
112
   } else {
113
      if(s.size_bytes() != expected) {
114
         throw Invalid_Argument("Memory regions did not have expected byte lengths");
115
      }
116
   }
117
187k
}
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm4ETkNS0_14spanable_rangeERNSt3__14spanIKhLm4EEEEEvOT0_
_ZN5Botan6ranges24assert_exact_byte_lengthILm4ETkNS0_14spanable_rangeERNSt3__14spanIhLm4EEEEEvOT0_
Line
Count
Source
108
145k
inline constexpr void assert_exact_byte_length(R&& r) {
109
145k
   const std::span s{r};
110
145k
   if constexpr(statically_spanable_range<R>) {
111
145k
      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
112
   } else {
113
      if(s.size_bytes() != expected) {
114
         throw Invalid_Argument("Memory regions did not have expected byte lengths");
115
      }
116
   }
117
145k
}
_ZN5Botan6ranges24assert_exact_byte_lengthILm4ETkNS0_14spanable_rangeERNSt3__14spanIKjLm1EEEEEvOT0_
Line
Count
Source
108
72.9k
inline constexpr void assert_exact_byte_length(R&& r) {
109
72.9k
   const std::span s{r};
110
72.9k
   if constexpr(statically_spanable_range<R>) {
111
72.9k
      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
112
   } else {
113
      if(s.size_bytes() != expected) {
114
         throw Invalid_Argument("Memory regions did not have expected byte lengths");
115
      }
116
   }
117
72.9k
}
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm2ETkNS0_14spanable_rangeERNSt3__14spanIhLm2EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm2ETkNS0_14spanable_rangeERNSt3__14spanIKtLm1EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm64ETkNS0_14spanable_rangeERNSt3__14spanIKhLm64EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm128ETkNS0_14spanable_rangeERNSt3__14spanIKhLm128EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm2ETkNS0_14spanable_rangeERNSt3__15arrayItLm1EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm1ETkNS0_14spanable_rangeERNSt3__15arrayIhLm1EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm1ETkNS0_14spanable_rangeERNSt3__14spanIhLm1EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm4ETkNS0_14spanable_rangeERNSt3__15arrayIjLm1EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm16ETkNS0_14spanable_rangeERNSt3__14spanIhLm16EEEEEvOT0_
_ZN5Botan6ranges24assert_exact_byte_lengthILm8ETkNS0_14spanable_rangeERNSt3__15arrayIhLm8EEEEEvOT0_
Line
Count
Source
108
563
inline constexpr void assert_exact_byte_length(R&& r) {
109
563
   const std::span s{r};
110
563
   if constexpr(statically_spanable_range<R>) {
111
563
      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
112
   } else {
113
      if(s.size_bytes() != expected) {
114
         throw Invalid_Argument("Memory regions did not have expected byte lengths");
115
      }
116
   }
117
563
}
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm2ETkNS0_14spanable_rangeERNSt3__14spanIKhLm2EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm16ETkNS0_14spanable_rangeERNSt3__14spanIKhLm16EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm16ETkNS0_14spanable_rangeERNSt3__15arrayImLm2EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm16ETkNS0_14spanable_rangeERNSt3__14spanIKhLm18446744073709551615EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm16ETkNS0_14spanable_rangeERNSt3__15arrayIhLm16EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm64ETkNS0_14spanable_rangeERNSt3__14spanIhLm64EEEEEvOT0_
_ZN5Botan6ranges24assert_exact_byte_lengthILm32ETkNS0_14spanable_rangeERKNSt3__15arrayImLm4EEEEEvOT0_
Line
Count
Source
108
9.20k
inline constexpr void assert_exact_byte_length(R&& r) {
109
9.20k
   const std::span s{r};
110
9.20k
   if constexpr(statically_spanable_range<R>) {
111
9.20k
      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
112
   } else {
113
      if(s.size_bytes() != expected) {
114
         throw Invalid_Argument("Memory regions did not have expected byte lengths");
115
      }
116
   }
117
9.20k
}
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm32ETkNS0_14spanable_rangeERNSt3__14spanImLm4EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm8ETkNS0_14spanable_rangeERNSt3__15arrayImLm1EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm48ETkNS0_14spanable_rangeERKNSt3__15arrayImLm6EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm48ETkNS0_14spanable_rangeERNSt3__15arrayImLm6EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm48ETkNS0_14spanable_rangeERNSt3__14spanIKhLm48EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm48ETkNS0_14spanable_rangeERNSt3__14spanImLm6EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm64ETkNS0_14spanable_rangeERKNSt3__15arrayImLm8EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm64ETkNS0_14spanable_rangeERNSt3__15arrayImLm8EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm64ETkNS0_14spanable_rangeERNSt3__14spanImLm8EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm72ETkNS0_14spanable_rangeERNSt3__15arrayImLm9EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm24ETkNS0_14spanable_rangeERKNSt3__15arrayImLm3EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm24ETkNS0_14spanable_rangeERNSt3__15arrayImLm3EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm24ETkNS0_14spanable_rangeERNSt3__14spanIKhLm24EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm24ETkNS0_14spanable_rangeERNSt3__14spanImLm3EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm28ETkNS0_14spanable_rangeERNSt3__14spanIKhLm28EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm72ETkNS0_14spanable_rangeERNSt3__14spanIKhLm72EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm72ETkNS0_14spanable_rangeERKNSt3__15arrayImLm9EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm66ETkNS0_14spanable_rangeERNSt3__14spanIKhLm66EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm98ETkNS0_14spanable_rangeERNSt3__14spanIKhLm98EEEEEvOT0_
Unexecuted instantiation: _ZN5Botan6ranges24assert_exact_byte_lengthILm72ETkNS0_14spanable_rangeERNSt3__14spanImLm9EEEEEvOT0_
118
119
/**
120
 * Check that a list of ranges (in @p r0 and @p rs) all have the same byte
121
 * lengths. If the first range's extent is known at compile time, this will be a
122
 * static check for all other ranges whose extents are known at compile time,
123
 * otherwise a runtime argument check will be added.
124
 *
125
 * @throws Invalid_Argument  if any range has a dynamic extent and not all
126
 *                           ranges feature the same byte length.
127
 */
128
template <spanable_range R0, spanable_range... Rs>
129
inline constexpr void assert_equal_byte_lengths(R0&& r0, Rs&&... rs)
130
   requires(sizeof...(Rs) > 0)
131
555k
{
132
555k
   const std::span s0{r0};
133
134
555k
   if constexpr(statically_spanable_range<R0>) {
135
438k
      constexpr size_t expected_size = s0.size_bytes();
136
438k
      (assert_exact_byte_length<expected_size>(rs), ...);
137
438k
   } else {
138
117k
      const size_t expected_size = s0.size_bytes();
139
117k
      const bool correct_size =
140
117k
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
117k
      if(!correct_size) {
143
0
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
0
      }
145
117k
   }
146
555k
}
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayImLm4EEETpTkNS0_14spanable_rangeEJRNS2_4spanIhLm32EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayImLm4EEETpTkNS0_14spanable_rangeEJRNS2_4spanIKhLm32EEEEEEvOT_DpOT0_QgtsZT0_Li0E
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm32EEETpTkNS0_14spanable_rangeEJRNS2_5arrayImLm4EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
18.1k
{
132
18.1k
   const std::span s0{r0};
133
134
18.1k
   if constexpr(statically_spanable_range<R0>) {
135
18.1k
      constexpr size_t expected_size = s0.size_bytes();
136
18.1k
      (assert_exact_byte_length<expected_size>(rs), ...);
137
   } else {
138
      const size_t expected_size = s0.size_bytes();
139
      const bool correct_size =
140
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
      if(!correct_size) {
143
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
      }
145
   }
146
18.1k
}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm18446744073709551615EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm18446744073709551615EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
8.60k
{
132
8.60k
   const std::span s0{r0};
133
134
   if constexpr(statically_spanable_range<R0>) {
135
      constexpr size_t expected_size = s0.size_bytes();
136
      (assert_exact_byte_length<expected_size>(rs), ...);
137
8.60k
   } else {
138
8.60k
      const size_t expected_size = s0.size_bytes();
139
8.60k
      const bool correct_size =
140
8.60k
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
8.60k
      if(!correct_size) {
143
0
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
0
      }
145
8.60k
   }
146
8.60k
}
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm18446744073709551615EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm18446744073709551615EEES8_EEEvOT_DpOT0_QgtsZT0_Li0E
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm18446744073709551615EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm18446744073709551615EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
4.60k
{
132
4.60k
   const std::span s0{r0};
133
134
   if constexpr(statically_spanable_range<R0>) {
135
      constexpr size_t expected_size = s0.size_bytes();
136
      (assert_exact_byte_length<expected_size>(rs), ...);
137
4.60k
   } else {
138
4.60k
      const size_t expected_size = s0.size_bytes();
139
4.60k
      const bool correct_size =
140
4.60k
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
4.60k
      if(!correct_size) {
143
0
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
0
      }
145
4.60k
   }
146
4.60k
}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm18446744073709551615EEETpTkNS0_14spanable_rangeEJRNS3_IKmLm18446744073709551615EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
604
{
132
604
   const std::span s0{r0};
133
134
   if constexpr(statically_spanable_range<R0>) {
135
      constexpr size_t expected_size = s0.size_bytes();
136
      (assert_exact_byte_length<expected_size>(rs), ...);
137
604
   } else {
138
604
      const size_t expected_size = s0.size_bytes();
139
604
      const bool correct_size =
140
604
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
604
      if(!correct_size) {
143
0
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
0
      }
145
604
   }
146
604
}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm1EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm8EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
150k
{
132
150k
   const std::span s0{r0};
133
134
150k
   if constexpr(statically_spanable_range<R0>) {
135
150k
      constexpr size_t expected_size = s0.size_bytes();
136
150k
      (assert_exact_byte_length<expected_size>(rs), ...);
137
   } else {
138
      const size_t expected_size = s0.size_bytes();
139
      const bool correct_size =
140
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
      if(!correct_size) {
143
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
      }
145
   }
146
150k
}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm8EEETpTkNS0_14spanable_rangeEJRNS3_IKmLm1EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
187k
{
132
187k
   const std::span s0{r0};
133
134
187k
   if constexpr(statically_spanable_range<R0>) {
135
187k
      constexpr size_t expected_size = s0.size_bytes();
136
187k
      (assert_exact_byte_length<expected_size>(rs), ...);
137
   } else {
138
      const size_t expected_size = s0.size_bytes();
139
      const bool correct_size =
140
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
      if(!correct_size) {
143
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
      }
145
   }
146
187k
}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIjLm18446744073709551615EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm18446744073709551615EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
89.7k
{
132
89.7k
   const std::span s0{r0};
133
134
   if constexpr(statically_spanable_range<R0>) {
135
      constexpr size_t expected_size = s0.size_bytes();
136
      (assert_exact_byte_length<expected_size>(rs), ...);
137
89.7k
   } else {
138
89.7k
      const size_t expected_size = s0.size_bytes();
139
89.7k
      const bool correct_size =
140
89.7k
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
89.7k
      if(!correct_size) {
143
0
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
0
      }
145
89.7k
   }
146
89.7k
}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm18446744073709551615EEETpTkNS0_14spanable_rangeEJRNS3_IKjLm18446744073709551615EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
9.65k
{
132
9.65k
   const std::span s0{r0};
133
134
   if constexpr(statically_spanable_range<R0>) {
135
      constexpr size_t expected_size = s0.size_bytes();
136
      (assert_exact_byte_length<expected_size>(rs), ...);
137
9.65k
   } else {
138
9.65k
      const size_t expected_size = s0.size_bytes();
139
9.65k
      const bool correct_size =
140
9.65k
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
9.65k
      if(!correct_size) {
143
0
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
0
      }
145
9.65k
   }
146
9.65k
}
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIjLm1EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm4EEEEEEvOT_DpOT0_QgtsZT0_Li0E
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm4EEETpTkNS0_14spanable_rangeEJRNS3_IKjLm1EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
72.9k
{
132
72.9k
   const std::span s0{r0};
133
134
72.9k
   if constexpr(statically_spanable_range<R0>) {
135
72.9k
      constexpr size_t expected_size = s0.size_bytes();
136
72.9k
      (assert_exact_byte_length<expected_size>(rs), ...);
137
   } else {
138
      const size_t expected_size = s0.size_bytes();
139
      const bool correct_size =
140
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
      if(!correct_size) {
143
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
      }
145
   }
146
72.9k
}
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm2EEETpTkNS0_14spanable_rangeEJRNS3_IKtLm1EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayIjLm16EEETpTkNS0_14spanable_rangeEJRNS2_4spanIKhLm64EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIjLm16EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm64EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayImLm16EEETpTkNS0_14spanable_rangeEJRNS2_4spanIKhLm128EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayIhLm2EEETpTkNS0_14spanable_rangeEJRNS3_ItLm1EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayIhLm1EEETpTkNS0_14spanable_rangeEJS5_EEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm18446744073709551615EEETpTkNS0_14spanable_rangeEJS5_EEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayIhLm4EEETpTkNS0_14spanable_rangeEJRNS3_IjLm1EEEEEEvOT_DpOT0_QgtsZT0_Li0E
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm1EEETpTkNS0_14spanable_rangeEJRNS3_IhLm8EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
563
{
132
563
   const std::span s0{r0};
133
134
563
   if constexpr(statically_spanable_range<R0>) {
135
563
      constexpr size_t expected_size = s0.size_bytes();
136
563
      (assert_exact_byte_length<expected_size>(rs), ...);
137
   } else {
138
      const size_t expected_size = s0.size_bytes();
139
      const bool correct_size =
140
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
      if(!correct_size) {
143
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
      }
145
   }
146
563
}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm18446744073709551615EEETpTkNS0_14spanable_rangeEJRKNS2_6vectorIhNS_16secure_allocatorIhEEEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
1.53k
{
132
1.53k
   const std::span s0{r0};
133
134
   if constexpr(statically_spanable_range<R0>) {
135
      constexpr size_t expected_size = s0.size_bytes();
136
      (assert_exact_byte_length<expected_size>(rs), ...);
137
1.53k
   } else {
138
1.53k
      const size_t expected_size = s0.size_bytes();
139
1.53k
      const bool correct_size =
140
1.53k
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
1.53k
      if(!correct_size) {
143
0
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
0
      }
145
1.53k
   }
146
1.53k
}
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanItLm1EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm2EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayImLm2EEETpTkNS0_14spanable_rangeEJRNS2_4spanIhLm16EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayImLm2EEETpTkNS0_14spanable_rangeEJRNS2_4spanIKhLm16EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm16EEETpTkNS0_14spanable_rangeEJRNS2_5arrayImLm2EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayIhLm16EEETpTkNS0_14spanable_rangeEJRNS2_4spanIKhLm18446744073709551615EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayIhLm16EEETpTkNS0_14spanable_rangeEJS5_EEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm18446744073709551615EEETpTkNS0_14spanable_rangeEJS5_S5_EEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayIhLm16EEETpTkNS0_14spanable_rangeEJRNS3_ImLm2EEEEEEvOT_DpOT0_QgtsZT0_Li0E
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm4EEETpTkNS0_14spanable_rangeEJRKNS2_5arrayImLm4EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
9.20k
{
132
9.20k
   const std::span s0{r0};
133
134
9.20k
   if constexpr(statically_spanable_range<R0>) {
135
9.20k
      constexpr size_t expected_size = s0.size_bytes();
136
9.20k
      (assert_exact_byte_length<expected_size>(rs), ...);
137
   } else {
138
      const size_t expected_size = s0.size_bytes();
139
      const bool correct_size =
140
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
      if(!correct_size) {
143
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
      }
145
   }
146
9.20k
}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__16vectorIhNS2_9allocatorIhEEEETpTkNS0_14spanable_rangeEJRA8_mEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
2.30k
{
132
2.30k
   const std::span s0{r0};
133
134
   if constexpr(statically_spanable_range<R0>) {
135
      constexpr size_t expected_size = s0.size_bytes();
136
      (assert_exact_byte_length<expected_size>(rs), ...);
137
2.30k
   } else {
138
2.30k
      const size_t expected_size = s0.size_bytes();
139
2.30k
      const bool correct_size =
140
2.30k
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
2.30k
      if(!correct_size) {
143
0
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
0
      }
145
2.30k
   }
146
2.30k
}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm32EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm32EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
543
{
132
543
   const std::span s0{r0};
133
134
543
   if constexpr(statically_spanable_range<R0>) {
135
543
      constexpr size_t expected_size = s0.size_bytes();
136
543
      (assert_exact_byte_length<expected_size>(rs), ...);
137
   } else {
138
      const size_t expected_size = s0.size_bytes();
139
      const bool correct_size =
140
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
      if(!correct_size) {
143
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
      }
145
   }
146
543
}
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayImLm4EEETpTkNS0_14spanable_rangeEJRNS2_4spanImLm4EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm1EEETpTkNS0_14spanable_rangeEJRNS2_5arrayImLm1EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm6EEETpTkNS0_14spanable_rangeEJRKNS2_5arrayImLm6EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm48EEETpTkNS0_14spanable_rangeEJRNS2_5arrayImLm6EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__16vectorIhNS2_9allocatorIhEEEETpTkNS0_14spanable_rangeEJRA12_mEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm48EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm48EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayImLm6EEETpTkNS0_14spanable_rangeEJRNS2_4spanImLm6EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm8EEETpTkNS0_14spanable_rangeEJRKNS2_5arrayImLm8EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm64EEETpTkNS0_14spanable_rangeEJRNS2_5arrayImLm8EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__16vectorIhNS2_9allocatorIhEEEETpTkNS0_14spanable_rangeEJRA16_mEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm64EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm64EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayImLm8EEETpTkNS0_14spanable_rangeEJRNS2_4spanImLm8EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm9EEETpTkNS0_14spanable_rangeEJRNS2_5arrayImLm9EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__16vectorIhNS2_9allocatorIhEEEETpTkNS0_14spanable_rangeEJRNS2_5arrayImLm18EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayIhLm72EEETpTkNS0_14spanable_rangeEJRNS3_ImLm9EEEEEEvOT_DpOT0_QgtsZT0_Li0E
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm18446744073709551615EEETpTkNS0_14spanable_rangeEJRNS3_IKmLm18446744073709551615EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Line
Count
Source
131
30
{
132
30
   const std::span s0{r0};
133
134
   if constexpr(statically_spanable_range<R0>) {
135
      constexpr size_t expected_size = s0.size_bytes();
136
      (assert_exact_byte_length<expected_size>(rs), ...);
137
30
   } else {
138
30
      const size_t expected_size = s0.size_bytes();
139
30
      const bool correct_size =
140
30
         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
141
142
30
      if(!correct_size) {
143
0
         throw Invalid_Argument("Memory regions did not have equal lengths");
144
0
      }
145
30
   }
146
30
}
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm3EEETpTkNS0_14spanable_rangeEJRKNS2_5arrayImLm3EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm24EEETpTkNS0_14spanable_rangeEJRNS2_5arrayImLm3EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__16vectorIhNS2_9allocatorIhEEEETpTkNS0_14spanable_rangeEJRA6_mEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm24EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm24EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayImLm3EEETpTkNS0_14spanable_rangeEJRNS2_4spanImLm3EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayIhLm32EEETpTkNS0_14spanable_rangeEJRNS3_ImLm4EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm28EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm28EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm72EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm72EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanImLm9EEETpTkNS0_14spanable_rangeEJRKNS2_5arrayImLm9EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm66EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm66EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__16vectorIhNS2_9allocatorIhEEEETpTkNS0_14spanable_rangeEJRA18_mEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__14spanIhLm98EEETpTkNS0_14spanable_rangeEJRNS3_IKhLm98EEEEEEvOT_DpOT0_QgtsZT0_Li0E
Unexecuted instantiation: _ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeERNSt3__15arrayImLm9EEETpTkNS0_14spanable_rangeEJRNS2_4spanImLm9EEEEEEvOT_DpOT0_QgtsZT0_Li0E
147
148
}  // namespace ranges
149
150
namespace concepts {
151
152
// TODO: C++20 provides concepts like std::ranges::range or ::sized_range
153
//       but at the time of this writing clang had not caught up on all
154
//       platforms. E.g. clang 14 on Xcode does not support ranges properly.
155
156
template <typename IterT, typename ContainerT>
157
concept container_iterator =
158
   std::same_as<IterT, typename ContainerT::iterator> || std::same_as<IterT, typename ContainerT::const_iterator>;
159
160
template <typename PtrT, typename ContainerT>
161
concept container_pointer =
162
   std::same_as<PtrT, typename ContainerT::pointer> || std::same_as<PtrT, typename ContainerT::const_pointer>;
163
164
template <typename T>
165
concept container = requires(T a) {
166
   { a.begin() } -> container_iterator<T>;
167
   { a.end() } -> container_iterator<T>;
168
   { a.cbegin() } -> container_iterator<T>;
169
   { a.cend() } -> container_iterator<T>;
170
   { a.size() } -> std::same_as<typename T::size_type>;
171
   typename T::value_type;
172
};
173
174
template <typename T>
175
concept contiguous_container = container<T> && requires(T a) {
176
   { a.data() } -> container_pointer<T>;
177
};
178
179
template <typename T>
180
concept has_empty = requires(T a) {
181
   { a.empty() } -> std::same_as<bool>;
182
};
183
184
// clang-format off
185
template <typename T>
186
concept has_bounds_checked_accessors = container<T> && (
187
                                          requires(T a, const T ac, typename T::size_type s) {
188
                                             { a.at(s) } -> std::same_as<typename T::value_type&>;
189
                                             { ac.at(s) } -> std::same_as<const typename T::value_type&>;
190
                                          } ||
191
                                          requires(T a, const T ac, typename T::key_type k) {
192
                                             { a.at(k) } -> std::same_as<typename T::mapped_type&>;
193
                                             { ac.at(k) } -> std::same_as<const typename T::mapped_type&>;
194
                                          });
195
// clang-format on
196
197
template <typename T>
198
concept resizable_container = container<T> && requires(T& c, typename T::size_type s) {
199
   T(s);
200
   c.resize(s);
201
};
202
203
template <typename T>
204
concept reservable_container = container<T> && requires(T& c, typename T::size_type s) { c.reserve(s); };
205
206
template <typename T>
207
concept resizable_byte_buffer =
208
   contiguous_container<T> && resizable_container<T> && std::same_as<typename T::value_type, uint8_t>;
209
210
template <typename T>
211
concept streamable = requires(std::ostream& os, T a) { os << a; };
212
213
template <class T>
214
concept strong_type = is_strong_type_v<T>;
215
216
template <class T>
217
concept contiguous_strong_type = strong_type<T> && contiguous_container<T>;
218
219
template <class T>
220
concept integral_strong_type = strong_type<T> && std::integral<typename T::wrapped_type>;
221
222
template <class T>
223
concept unsigned_integral_strong_type = strong_type<T> && std::unsigned_integral<typename T::wrapped_type>;
224
225
template <typename T, typename Capability>
226
concept strong_type_with_capability = T::template has_capability<Capability>();
227
228
}  // namespace concepts
229
230
}  // namespace Botan
231
232
#endif