Skip to content

Commit

Permalink
Prevent SonarCloud warning (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
swebb2066 authored Oct 19, 2023
1 parent 1681351 commit 624642a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/main/include/log4cxx/helpers/widelife.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#define _LOG4CXX_HELPERS_WIDELIFE_H

#include <log4cxx/log4cxx.h>
#if defined(__cpp_concepts) && __cpp_concepts >= 201500
#include <concepts>
#endif

namespace log4cxx
{
Expand All @@ -33,10 +36,17 @@ template <class T>
class WideLife
{
public:
template <class... Args>
WideLife(Args&&... args)
WideLife()
{
new(&storage) T();
}
template <class Arg0, class... Args>
#if defined(__cpp_concepts) && __cpp_concepts >= 201500
requires (!std::same_as<WideLife, Arg0>)
#endif
WideLife(Arg0&& arg0, Args&&... args)
{
new(&storage) T(std::forward<Args>(args)...);
new(&storage) T(std::forward<Arg0>(arg0), std::forward<Args>(args)...);
}

~WideLife()
Expand Down

0 comments on commit 624642a

Please sign in to comment.