diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-08-30 21:12:38 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-08-30 21:12:38 +0100 |
commit | 1ae4dcd724d5267f754f3bd65bdcdcf26288ea39 (patch) | |
tree | d879352165df287a31a8594bbc6cc2c5ef3f25ab | |
parent | Simplify CTF bad format handling (diff) | |
download | libadhocutil-1ae4dcd724d5267f754f3bd65bdcdcf26288ea39.tar.bz2 libadhocutil-1ae4dcd724d5267f754f3bd65bdcdcf26288ea39.tar.xz libadhocutil-1ae4dcd724d5267f754f3bd65bdcdcf26288ea39.zip |
Add in a template type arg for enable_if
-rw-r--r-- | libadhocutil/compileTimeFormatter.h | 8 | ||||
-rw-r--r-- | libadhocutil/detail/compileTimeFormatters.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/libadhocutil/compileTimeFormatter.h b/libadhocutil/compileTimeFormatter.h index 1e2a99c..8d60800 100644 --- a/libadhocutil/compileTimeFormatter.h +++ b/libadhocutil/compileTimeFormatter.h @@ -36,7 +36,7 @@ namespace AdHoc { template <const auto & S, decltype(strlen<S>())> class Formatter; - template<const auto & S, auto L, auto pos, typename stream, auto ...> + template<const auto & S, auto L, auto pos, typename stream, typename, auto ...> struct StreamWriter { template<typename ... Pn> static void write(stream &, const Pn & ...) @@ -56,12 +56,12 @@ namespace AdHoc { #define StreamWriterT(C...) \ template<const auto & S, auto L, auto pos, typename stream, auto ... sn> \ - struct StreamWriter<S, L, pos, stream, '%', C, sn...> : \ + struct StreamWriter<S, L, pos, stream, void, '%', C, sn...> : \ public StreamWriterBase<S, L, BOOST_PP_VARIADIC_SIZE(C) + pos, stream> #define StreamWriterTP(P, C...) \ template<const auto & S, auto L, auto pos, typename stream, auto P, auto ... sn> \ - struct StreamWriter<S, L, pos, stream, '%', C, sn...> : \ + struct StreamWriter<S, L, pos, stream, void, '%', C, sn...> : \ public StreamWriterBase<S, L, BOOST_PP_VARIADIC_SIZE(C) + pos, stream> // Default stream writer formatter @@ -153,7 +153,7 @@ namespace AdHoc { static inline void packAndWrite(stream & s, const Pn & ... pn) { if constexpr (ph + off == L || sizeof...(Pck) == 32) { - StreamWriter<S, L, ph, stream, Pck...>::write(s, pn...); + StreamWriter<S, L, ph, stream, void, Pck...>::write(s, pn...); } else if constexpr (ph + off < L) { packAndWrite<ph, off + 1, Pck..., S[ph + off]>(s, pn...); diff --git a/libadhocutil/detail/compileTimeFormatters.h b/libadhocutil/detail/compileTimeFormatters.h index 3b12ea9..8579f92 100644 --- a/libadhocutil/detail/compileTimeFormatters.h +++ b/libadhocutil/detail/compileTimeFormatters.h @@ -97,7 +97,7 @@ namespace AdHoc { static inline void write(stream & s, int l, const Pn & ... pn) { s << std::setw(l) << std::setprecision(l); - StreamWriter<S, L, pos + 2, stream, '%', sn...>::write(s, pn...); + StreamWriter<S, L, pos + 2, stream, void, '%', sn...>::write(s, pn...); } }; StreamWriterT('.', '*', 's') { @@ -114,7 +114,7 @@ namespace AdHoc { StreamWriterT(__VA_ARGS__) { \ template<typename ... Pn> static inline void write(stream & s, const Pn & ... pn) { \ OP; \ - StreamWriter<S, L, pos + 1, stream, '%', sn...>::write(s, pn...); \ + StreamWriter<S, L, pos + 1, stream, void, '%', sn...>::write(s, pn...); \ } \ }; FLAGCONV(s << std::showbase, '#'); |