From a375f0f1601a5a28ec5ac5f40826dfcc3ffa5438 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 11 May 2022 11:53:48 +0200 Subject: [PATCH] io/BufferedReader: add method ReadFullT() --- src/io/BufferedReader.hxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/io/BufferedReader.hxx b/src/io/BufferedReader.hxx index d22a2ecf9..8df6b3909 100644 --- a/src/io/BufferedReader.hxx +++ b/src/io/BufferedReader.hxx @@ -66,6 +66,18 @@ public: */ void ReadFull(std::span dest); + template + void ReadFullT(T &dest) { + ReadFull({&dest, sizeof(dest)}); + } + + template + T ReadFullT() { + T dest; + ReadFullT(dest); + return dest; + } + char *ReadLine(); unsigned GetLineNumber() const noexcept {