diff --git a/src/io/Reader.hxx b/src/io/Reader.hxx index 473d2ddf6..970706548 100644 --- a/src/io/Reader.hxx +++ b/src/io/Reader.hxx @@ -5,6 +5,7 @@ #define READER_HXX #include +#include /** * An interface that can read bytes from a stream until the stream @@ -26,6 +27,13 @@ public: */ [[gnu::nonnull]] virtual std::size_t Read(void *data, std::size_t size) = 0; + + template + requires std::is_standard_layout_v && std::is_trivially_copyable_v + void ReadT(T &dest) { + // TODO check return value + Read(&dest, sizeof(dest)); + } }; #endif