mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
ircd::buffer: Add std::ostream support.
This commit is contained in:
parent
ca98521265
commit
bd772a4452
1 changed files with 24 additions and 0 deletions
|
@ -106,6 +106,9 @@ template<class it> size_t copy(char *const &dest, const size_t &max, const buffe
|
||||||
template<class T> char *copy(char *&dest, char *const &stop, const buffers<T> &buffer);
|
template<class T> char *copy(char *&dest, char *const &stop, const buffers<T> &buffer);
|
||||||
template<class T> size_t copy(char *const &dest, const size_t &max, const buffers<T> &buffer);
|
template<class T> size_t copy(char *const &dest, const size_t &max, const buffers<T> &buffer);
|
||||||
|
|
||||||
|
template<class it> std::ostream &operator<<(std::ostream &s, const buffer<it> &buffer);
|
||||||
|
template<class T> std::ostream &operator<<(std::ostream &s, const buffers<T> &buffers);
|
||||||
|
|
||||||
} // namespace buffer
|
} // namespace buffer
|
||||||
|
|
||||||
using buffer::const_buffer;
|
using buffer::const_buffer;
|
||||||
|
@ -118,6 +121,27 @@ using buffer::null_buffers;
|
||||||
|
|
||||||
} // namespace ircd
|
} // namespace ircd
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
std::ostream &
|
||||||
|
ircd::buffer::operator<<(std::ostream &s, const buffers<T> &buffers)
|
||||||
|
{
|
||||||
|
std::for_each(begin(buffers), end(buffers), [&s]
|
||||||
|
(const auto &buffer)
|
||||||
|
{
|
||||||
|
s << buffer;
|
||||||
|
});
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class it>
|
||||||
|
std::ostream &
|
||||||
|
ircd::buffer::operator<<(std::ostream &s, const buffer<it> &buffer)
|
||||||
|
{
|
||||||
|
s.write(data(buffer), size(buffer));
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
size_t
|
size_t
|
||||||
ircd::buffer::copy(char *const &dest,
|
ircd::buffer::copy(char *const &dest,
|
||||||
|
|
Loading…
Reference in a new issue