Use std::ranges::distance instead implementation with std::ranges::fold_left for stream errors
This commit is contained in:
parent
5d991d287c
commit
cfd566d52a
1 changed files with 2 additions and 4 deletions
|
@ -56,10 +56,8 @@ struct ErrorImpl : BaseError {
|
||||||
static constexpr auto str = [] {
|
static constexpr auto str = [] {
|
||||||
return std::array{std::string_view{"Stream Error: "}, nameof::nameof_short_type<T>(), std::string_view{"\0", 1}} | std::views::join;
|
return std::array{std::string_view{"Stream Error: "}, nameof::nameof_short_type<T>(), std::string_view{"\0", 1}} | std::views::join;
|
||||||
};
|
};
|
||||||
constexpr auto size = std::ranges::fold_left(str(), std::size_t{}, [](auto accum, auto) {
|
constexpr auto size = std::ranges::distance(str());
|
||||||
return accum + 1;
|
static constexpr auto array = [&] {
|
||||||
});
|
|
||||||
static constexpr auto array = [] {
|
|
||||||
std::array<char, size> response; // NOLINT
|
std::array<char, size> response; // NOLINT
|
||||||
std::ranges::copy(str(), response.begin());
|
std::ranges::copy(str(), response.begin());
|
||||||
return response;
|
return response;
|
||||||
|
|
Loading…
Reference in a new issue