summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-08-20 19:46:32 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-08-20 19:46:32 +0100
commitad90cc09bcc55485a831a58762d242bbb3bffdb8 (patch)
treef5f3acccfa122d4555d1e8b4cb42cdd0bce0d3cc
parentC++17 deprecation warnings from GCC 8.2 (diff)
downloadlibadhocutil-ad90cc09bcc55485a831a58762d242bbb3bffdb8.tar.bz2
libadhocutil-ad90cc09bcc55485a831a58762d242bbb3bffdb8.tar.xz
libadhocutil-ad90cc09bcc55485a831a58762d242bbb3bffdb8.zip
Fix compilation with template auto and + operator
-rw-r--r--libadhocutil/compileTimeFormatter.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/libadhocutil/compileTimeFormatter.h b/libadhocutil/compileTimeFormatter.h
index b05e9f4..0551f62 100644
--- a/libadhocutil/compileTimeFormatter.h
+++ b/libadhocutil/compileTimeFormatter.h
@@ -34,7 +34,7 @@ namespace AdHoc {
return off;
}
- template <const auto &, int> class Formatter;
+ template <const auto & S, decltype(strlen<S>())> class Formatter;
template<const auto & S, auto L, auto pos, typename stream, auto ...>
struct StreamWriter {
@@ -105,9 +105,10 @@ namespace AdHoc {
* Compile time string formatter.
* @param S the format string.
*/
- template <const auto & S, int L = strlen<S>()>
+ template <const auto & S, decltype(strlen<S>()) L = strlen<S>()>
class Formatter {
private:
+ typedef decltype(strlen<S>()) strlen_t;
template<const auto &, auto, auto, typename> friend struct StreamWriterBase;
public:
@@ -153,7 +154,7 @@ namespace AdHoc {
}
return s;
}
- template<auto ph, auto off = 0, auto ... Pck>
+ template<strlen_t ph, strlen_t off = 0, auto ... Pck>
static inline void packAndWrite(stream & s, const Pn & ... pn)
{
if constexpr (ph + off == L || sizeof...(Pck) == 32) {