From 8bfdd7884bef5465a876813ec5433c931352fdba Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 26 May 2020 03:30:38 -0700 Subject: [PATCH] ircd::m::id: Use generate template; optimize printer. --- matrix/id.cc | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/matrix/id.cc b/matrix/id.cc index 64f271aed..0d9d2ee46 100644 --- a/matrix/id.cc +++ b/matrix/id.cc @@ -370,12 +370,23 @@ const }; }}; - const auto gg + mutable_buffer buf { - maxwidth(size_t(stop - out))[std::forward(g)] | eps[throws] + out, stop }; - return karma::generate(out, gg, std::forward(a)); + const auto gg + { + std::forward(g) | eps[throws] + }; + + const auto ret + { + generate(buf, gg, std::forward(a)) + }; + + out = buffer::data(buf); + return ret; } template @@ -395,12 +406,23 @@ const }; }}; - const auto gg + mutable_buffer buf { - maxwidth(size_t(stop - out))[std::forward(g)] | eps[throws] + out, stop }; - return karma::generate(out, gg); + const auto gg + { + std::forward(g) | eps[throws] + }; + + const auto ret + { + generate(buf, gg) + }; + + out = buffer::data(buf); + return ret; } template