From e69c5c3d31abb556a2362afaaae02f96f6d7661e Mon Sep 17 00:00:00 2001 From: namark <nshan.nnnn@gmail.com> Date: Wed, 20 Dec 2017 20:16:43 +0400 Subject: [PATCH] size function now accepts an rvalue stream. --- source/simple/file.hpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/simple/file.hpp b/source/simple/file.hpp index 4293f15..0e0bf75 100644 --- a/source/simple/file.hpp +++ b/source/simple/file.hpp @@ -24,6 +24,7 @@ namespace simple static const string path_delimeters = R"(/\)"s; inline size_type size(stream& file); + inline size_type size(stream&& file); inline void dump(stream& from, char* to, size_type this_much); template<typename Alloc = dfltAlloc> @@ -142,10 +143,16 @@ namespace string_stack inline size_type size(stream& file) { auto current = file.tellg(); - file.seekg(0, file.end); - auto size = file.tellg(); + auto ret = size(std::move(file)); file.seekg(current); - return size; + return ret; + } + + inline size_type size(stream&& file) + { + file.seekg(0, file.end); + auto ret = file.tellg(); + return ret; } inline void dump(stream& from, char* to, size_type this_much) -- GitLab