Use std::ranges::distance instead implementation with std::ranges::fold_left for stream errors

This commit is contained in:
sha512sum 2024-10-18 15:08:49 +00:00
parent 5d991d287c
commit cfd566d52a

View file

@ -56,10 +56,8 @@ struct ErrorImpl : BaseError {
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;
};
constexpr auto size = std::ranges::fold_left(str(), std::size_t{}, [](auto accum, auto) {
return accum + 1;
});
static constexpr auto array = [] {
constexpr auto size = std::ranges::distance(str());
static constexpr auto array = [&] {
std::array<char, size> response; // NOLINT
std::ranges::copy(str(), response.begin());
return response;