Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2018. The current version is 1.89.0.
Return a completion condition function object that indicates that a read or write operation should continue until a minimum number of bytes has been transferred, or until an error occurs.
unspecified transfer_at_least(
std::size_t minimum);
This function is used to create an object, of unspecified type, that meets CompletionCondition requirements.
Reading until a buffer is full or contains at least 64 bytes:
boost::array<char, 128> buf;
boost::system::error_code ec;
std::size_t n = boost::asio::read(
sock, boost::asio::buffer(buf),
boost::asio::transfer_at_least(64), ec);
if (ec)
{
// An error occurred.
}
else
{
// n >= 64 && n <= 128
}
Header: boost/asio/completion_condition.hpp
Convenience header: boost/asio.hpp