summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-08-30 21:05:31 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-08-30 21:05:31 +0100
commit232f6266732e624af676f8d17043d6f1a0b3f272 (patch)
treef1e2d07c23ddbc44565da4ecfbed5cd761d5788c
parentUse string_view instead of string where string-like is required (diff)
downloadlibadhocutil-232f6266732e624af676f8d17043d6f1a0b3f272.tar.bz2
libadhocutil-232f6266732e624af676f8d17043d6f1a0b3f272.tar.xz
libadhocutil-232f6266732e624af676f8d17043d6f1a0b3f272.zip
Simplify CTF bad format handling
static assertion is now just the default behaviour, not a catch all template class
-rw-r--r--libadhocutil/compileTimeFormatter.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/libadhocutil/compileTimeFormatter.h b/libadhocutil/compileTimeFormatter.h
index 4fcb1cb..1e2a99c 100644
--- a/libadhocutil/compileTimeFormatter.h
+++ b/libadhocutil/compileTimeFormatter.h
@@ -38,6 +38,11 @@ namespace AdHoc {
template<const auto & S, auto L, auto pos, typename stream, auto ...>
struct StreamWriter {
+ template<typename ... Pn>
+ static void write(stream &, const Pn & ...)
+ {
+ static_assert(!L, "invalid format string/arguments");
+ }
};
template<const auto & S, auto L, auto pos, typename stream>
@@ -79,16 +84,6 @@ namespace AdHoc {
}
};
- // Unknown stream writer formatter
- template<const auto & S, auto L, auto pos, typename stream, auto ... sn>
- struct StreamWriter<S, L, pos, stream, '%', sn...> {
- template<typename ... Pn>
- static void write(stream & s, const Pn & ...)
- {
- static_assert(!&s, "invalid format string/arguments");
- }
- };
-
template<typename stream, typename char_type>
static inline void appendStream(stream & s, const char_type * p, size_t n)
{