Commit f25261c 1 parent e87fc89 commit f25261c Copy full SHA for f25261c
File tree 3 files changed +8
-17
lines changed
3 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -240,12 +240,13 @@ namespace glz
240
240
template <string_literal Str>
241
241
inline constexpr auto escape_unicode = []() constexpr -> std::string_view {
242
242
constexpr auto escaped = []() constexpr {
243
- constexpr auto output_length = detail::escaped_length (Str.sv ());
244
- std::array<char , output_length + 1 > result{} ; // + 1 for null character
245
- const auto escaped = detail::escape_json_string (Str.sv (), output_length );
246
- for (size_t i = 0 ; i < output_length ; ++i) {
243
+ constexpr auto len = detail::escaped_length (Str.sv ());
244
+ std::array<char , len + 1 > result; // + 1 for null character
245
+ const auto escaped = detail::escape_json_string (Str.sv (), len );
246
+ for (size_t i = 0 ; i < len ; ++i) {
247
247
result[i] = escaped[i];
248
248
}
249
+ result[len] = ' \0 ' ;
249
250
return result;
250
251
}();
251
252
Original file line number Diff line number Diff line change @@ -81,12 +81,12 @@ namespace glz
81
81
{
82
82
constexpr auto joined_arr = []() {
83
83
constexpr size_t len = (Strs.size () + ... + 0 );
84
- std::array<char , len + 1 > arr{} ;
84
+ std::array<char , len + 1 > arr;
85
85
auto append = [i = 0 , &arr](const auto & s) mutable {
86
86
for (auto c : s) arr[i++] = c;
87
87
};
88
88
(append (Strs), ...);
89
- arr[len] = 0 ;
89
+ arr[len] = ' \0 ' ;
90
90
return arr;
91
91
}();
92
92
auto & static_arr = make_static<joined_arr>::value;
Original file line number Diff line number Diff line change @@ -15,17 +15,7 @@ namespace glz
15
15
template <class T >
16
16
concept is_std_tuple = is_specialization_v<T, std::tuple>;
17
17
18
- // group builder code
19
- template <size_t N>
20
- constexpr auto shrink_index_array (auto && arr)
21
- {
22
- std::array<size_t , N> res{};
23
- for (size_t i = 0 ; i < N; ++i) {
24
- res[i] = arr[i];
25
- }
26
- return res;
27
- }
28
-
18
+ // TODO: This doesn't appear to be used. Should it be removed?
29
19
template <class Type >
30
20
concept is_schema_class = requires {
31
21
requires std::is_class_v<Type>;
You can’t perform that action at this time.
0 commit comments