0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-06 02:28:38 +02:00

ircd::buffer: Add null()/empty() participation.

This commit is contained in:
Jason Volk 2017-10-17 00:50:07 -07:00
parent e2923336b8
commit a8b3d08c3a

View file

@ -81,6 +81,9 @@ namespace ircd::buffer
template<class it> it rend(const buffer<it> &buffer);
// Single buffer tools
template<class it> bool null(const buffer<it> &buffer);
template<class it> bool empty(const buffer<it> &buffer);
template<class it> bool operator!(const buffer<it> &buffer);
template<class it> size_t size(const buffer<it> &buffer);
template<class it> const it &data(const buffer<it> &buffer);
template<class it> size_t consume(buffer<it> &buffer, const size_t &bytes);
@ -569,6 +572,27 @@ ircd::buffer::size(const buffer<it> &buffer)
return std::distance(get<0>(buffer), get<1>(buffer));
}
template<class it>
bool
ircd::buffer::operator!(const buffer<it> &buffer)
{
return empty(buffer);
}
template<class it>
bool
ircd::buffer::empty(const buffer<it> &buffer)
{
return null(buffer) || !std::distance(get<0>(buffer), get<1>(buffer));
}
template<class it>
bool
ircd::buffer::null(const buffer<it> &buffer)
{
return get<0>(buffer) == nullptr;
}
template<class it>
it
ircd::buffer::rend(const buffer<it> &buffer)