From cfd566d52ac03b89f337620e3d6050ce7e1bc03a Mon Sep 17 00:00:00 2001 From: sha512sum Date: Fri, 18 Oct 2024 15:08:49 +0000 Subject: [PATCH] Use std::ranges::distance instead implementation with std::ranges::fold_left for stream errors --- library/include/larra/stream_error.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/library/include/larra/stream_error.hpp b/library/include/larra/stream_error.hpp index e6d080f..8f1b500 100644 --- a/library/include/larra/stream_error.hpp +++ b/library/include/larra/stream_error.hpp @@ -56,10 +56,8 @@ struct ErrorImpl : BaseError { static constexpr auto str = [] { return std::array{std::string_view{"Stream Error: "}, nameof::nameof_short_type(), 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 response; // NOLINT std::ranges::copy(str(), response.begin()); return response;