io: add a trivial type reader for fds
This commit is contained in:
parent
1c0ff49bb0
commit
348e45260f
11
io.hpp
11
io.hpp
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user