From 624642a4e1c14d23cacca6df736ee4a7e83f878d Mon Sep 17 00:00:00 2001 From: Stephen Webb Date: Thu, 19 Oct 2023 14:57:32 +1100 Subject: [PATCH] Prevent SonarCloud warning (#276) --- src/main/include/log4cxx/helpers/widelife.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/include/log4cxx/helpers/widelife.h b/src/main/include/log4cxx/helpers/widelife.h index aee301570..bafcf982c 100644 --- a/src/main/include/log4cxx/helpers/widelife.h +++ b/src/main/include/log4cxx/helpers/widelife.h @@ -19,6 +19,9 @@ #define _LOG4CXX_HELPERS_WIDELIFE_H #include +#if defined(__cpp_concepts) && __cpp_concepts >= 201500 +#include +#endif namespace log4cxx { @@ -33,10 +36,17 @@ template class WideLife { public: - template - WideLife(Args&&... args) + WideLife() + { + new(&storage) T(); + } + template +#if defined(__cpp_concepts) && __cpp_concepts >= 201500 + requires (!std::same_as) +#endif + WideLife(Arg0&& arg0, Args&&... args) { - new(&storage) T(std::forward(args)...); + new(&storage) T(std::forward(arg0), std::forward(args)...); } ~WideLife()