From 56f4d156af760157706cd2e71adad15b19630e6f Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 22 Dec 2017 17:29:21 -0700 Subject: [PATCH] ircd::buffer: Attempt to tighten these buffers templates by specifying buffer. --- include/ircd/buffer.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/ircd/buffer.h b/include/ircd/buffer.h index 37992f45f..65146a4d6 100644 --- a/include/ircd/buffer.h +++ b/include/ircd/buffer.h @@ -529,8 +529,10 @@ template std::ostream & ircd::buffer::operator<<(std::ostream &s, const buffers &b) { + using it = typename T::iterator; + std::for_each(std::begin(b), std::end(b), [&s] - (const T &b) + (const buffer &b) { s << b; }); @@ -569,8 +571,10 @@ size_t ircd::buffer::copy(const mutable_raw_buffer &dest, const buffers &b) { + using it = typename T::iterator; + size_t ret(0); - for(const T &b : b) + for(const buffer &b : b) ret += copy(data(dest) + ret, size(dest) - ret, b); return ret; @@ -582,8 +586,10 @@ template size_t ircd::buffer::size(const buffers &b) { + using it = typename T::iterator; + return std::accumulate(std::begin(b), std::end(b), size_t(0), [] - (auto ret, const T &b) + (auto ret, const buffer &b) { return ret += size(b); });