diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-08-30 21:05:31 +0100 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-08-30 21:05:31 +0100 | 
| commit | 232f6266732e624af676f8d17043d6f1a0b3f272 (patch) | |
| tree | f1e2d07c23ddbc44565da4ecfbed5cd761d5788c | |
| parent | Use string_view instead of string where string-like is required (diff) | |
| download | libadhocutil-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.h | 15 | 
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)  	{ | 
