From 1893127e8468e67e0cc5ccd7ffcda8686d441490 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 28 Feb 2020 14:05:51 -0500 Subject: [PATCH] use fold expression if C++17 --- libi2pd/Log.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libi2pd/Log.h b/libi2pd/Log.h index b11c6763..ba10b5e9 100644 --- a/libi2pd/Log.h +++ b/libi2pd/Log.h @@ -161,6 +161,7 @@ void LogPrint (std::stringstream& s, TValue&& arg) noexcept s << std::forward(arg); } +#if (__cplusplus < 201703L) // below C++ 17 /** internal usage only -- folding args array to single string */ template void LogPrint (std::stringstream& s, TValue&& arg, TArgs&&... args) noexcept @@ -168,6 +169,7 @@ void LogPrint (std::stringstream& s, TValue&& arg, TArgs&&... args) noexcept LogPrint (s, std::forward(arg)); LogPrint (s, std::forward(args)...); } +#endif /** * @brief Create log message and send it to queue @@ -184,7 +186,11 @@ void LogPrint (LogLevel level, TArgs&&... args) noexcept // fold message to single string std::stringstream ss(""); +#if (__cplusplus >= 201703L) // C++ 17 or higher + (LogPrint (ss, std::forward(args)), ...); +#else LogPrint (ss, std::forward(args)...); +#endif auto msg = std::make_shared(level, std::time(nullptr), ss.str()); msg->tid = std::this_thread::get_id();