Skip to content

Commit

Permalink
fix: 🐛 Make the code compile, take 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ion098 authored Sep 9, 2024
1 parent 4625471 commit 0d6046c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scope_guard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,22 @@ namespace sg
std::is_nothrow_destructible<T>>
{};

template<ExitType exit_type> class ShouldRun;
template<> class ShouldRun<ExitType::ALWAYS> {
template<ExitType exit_type> struct ShouldRun;
template<> struct ShouldRun<ExitType::ALWAYS> {
constexpr static bool should_run() { return true; }
};
#if __cplusplus >= 202002L
template<> class ShouldRun<ExitType::ON_SUCCESS> {
#if __cplusplus >= 201703L
template<> struct ShouldRun<ExitType::ON_SUCCESS> {
static bool should_run() { return std::uncaught_exceptions() == 0; }
};
template<> class ShouldRun<ExitType::ON_FAILURE> {
template<> struct ShouldRun<ExitType::ON_FAILURE> {
static bool should_run() { return std::uncaught_exceptions() != 0; }
};
#elif __cplusplus >= 201411L
template<> class ShouldRun<ExitType::ON_SUCCESS> {
template<> struct ShouldRun<ExitType::ON_SUCCESS> {
static bool should_run() { return !std::uncaught_exception(); }
};
template<> class ShouldRun<ExitType::ON_FAILURE> {
template<> struct ShouldRun<ExitType::ON_FAILURE> {
static bool should_run() { return std::uncaught_exception(); }
};
#endif
Expand Down

0 comments on commit 0d6046c

Please sign in to comment.