Selaa lähdekoodia

Using std::uncaught_exceptions() as this is available now (fixes #78).

main
offa 7 vuotta sitten
vanhempi
commit
8732ecbb20
2 muutettua tiedostoa jossa 4 lisäystä ja 13 poistoa
  1. +2
    -7
      include/scope_fail.h
  2. +2
    -6
      include/scope_success.h

+ 2
- 7
include/scope_fail.h Näytä tiedosto

@@ -32,16 +32,11 @@ namespace sr
{
bool should_execute() const noexcept
{
return uncaught_exceptions() > m_uncaught_on_creation;
}

int uncaught_exceptions() const noexcept
{
return ( std::uncaught_exception() == true ? 1 : 0 );
return std::uncaught_exceptions() > m_uncaught_on_creation;
}


int m_uncaught_on_creation = uncaught_exceptions();
int m_uncaught_on_creation = std::uncaught_exceptions();
};



+ 2
- 6
include/scope_success.h Näytä tiedosto

@@ -32,15 +32,11 @@ namespace sr
{
bool should_execute() const noexcept
{
return uncaught_exceptions() <= m_uncaught_on_creation;
return std::uncaught_exceptions() <= m_uncaught_on_creation;
}

int uncaught_exceptions() const noexcept
{
return ( std::uncaught_exception() == true ? 1 : 0 );
}

int m_uncaught_on_creation = uncaught_exceptions();
int m_uncaught_on_creation = std::uncaught_exceptions();
};

}

Loading…
Peruuta
Tallenna