From 0b887cd08315967d38a45ce4ec70e5bb3eb84752 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 17 Jun 2018 14:06:23 +0100 Subject: Use template auto types throughout CTF --- libadhocutil/compileTimeFormatter.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libadhocutil/compileTimeFormatter.h b/libadhocutil/compileTimeFormatter.h index 4b268f7..82cfa79 100644 --- a/libadhocutil/compileTimeFormatter.h +++ b/libadhocutil/compileTimeFormatter.h @@ -17,7 +17,7 @@ namespace AdHoc { } template()> - static constexpr int strchr() + static constexpr auto strchr() { static_assert(start <= L); decltype(start) off = start; @@ -34,13 +34,13 @@ namespace AdHoc { return off; } - template class Formatter; + template class Formatter; - template + template struct StreamWriter { }; - template + template struct StreamWriterBase { template static inline void next(stream & s, const Pn & ... pn) @@ -50,12 +50,12 @@ namespace AdHoc { }; #define StreamWriterT(C...) \ - template \ + template \ struct StreamWriter : \ public StreamWriterBase #define StreamWriterTP(P, C...) \ - template \ + template \ struct StreamWriter : \ public StreamWriterBase @@ -80,7 +80,7 @@ namespace AdHoc { }; // Unknown stream writer formatter - template + template struct StreamWriter { template static void write(stream &, const Pn & ...) @@ -94,10 +94,10 @@ namespace AdHoc { * Compile time string formatter. * @param S the format string. */ - template ()> + template ()> class Formatter { private: - template friend struct StreamWriterBase; + template friend struct StreamWriterBase; public: /** @@ -125,13 +125,13 @@ namespace AdHoc { } private: - template + template struct Parser { static inline stream & run(stream & s, const Pn & ... pn) { if (pos != L) { - constexpr int ph = strchrnul(); + constexpr auto ph = strchrnul(); if constexpr (ph != pos) { s.write((S + pos), ph - pos); } @@ -141,7 +141,7 @@ namespace AdHoc { } return s; } - template + template static inline void packAndWrite(stream & s, const Pn & ... pn) { if constexpr (ph + off == L || sizeof...(Pck) == 32) { -- cgit v1.2.3