io: add a trivial type reader for fds

This commit is contained in:
Danny Robson 2022-09-14 14:18:49 +10:00
parent 1c0ff49bb0
commit 348e45260f
1 changed files with 11 additions and 0 deletions

11
io.hpp
View File

@ -148,6 +148,17 @@ namespace cruft {
}
template <typename ValueT>
requires (std::is_trivial_v<ValueT>)
ValueT
read (cruft::posix::fd &src)
{
ValueT res;
read (src, cruft::make_byte_view<u08> (res));
return res;
}
///////////////////////////////////////////////////////////////////////////
class indenter : public std::streambuf {
protected: