Преглед изворни кода

Noexcept of scope guard mctors updated to P0052R5 (#49).

main
offa пре 7 година
родитељ
комит
7b96c2afee
3 измењених фајлова са 12 додато и 6 уклоњено
  1. +4
    -2
      include/scope_exit.h
  2. +4
    -2
      include/scope_fail.h
  3. +4
    -2
      include/scope_success.h

+ 4
- 2
include/scope_exit.h Прегледај датотеку

@@ -60,7 +60,8 @@ namespace sr
template<class T = EF,
std::enable_if_t<std::is_nothrow_move_constructible<T>::value, int> = 0
>
scope_exit(scope_exit&& other) : m_exitFunction(std::move(other.m_exitFunction)),
scope_exit(scope_exit&& other) noexcept(std::is_nothrow_move_constructible<T>::value || std::is_nothrow_copy_constructible<T>::value)
: m_exitFunction(std::move(other.m_exitFunction)),
m_execute_on_destruction(other.m_execute_on_destruction)
{
other.release();
@@ -69,7 +70,8 @@ namespace sr
template<class T = EF,
std::enable_if_t<!std::is_nothrow_move_constructible<T>::value, int> = 0
>
scope_exit(scope_exit&& other) : m_exitFunction(other.m_exitFunction),
scope_exit(scope_exit&& other) noexcept(std::is_nothrow_move_constructible<T>::value || std::is_nothrow_copy_constructible<T>::value)
: m_exitFunction(other.m_exitFunction),
m_execute_on_destruction(other.m_execute_on_destruction)
{
other.release();

+ 4
- 2
include/scope_fail.h Прегледај датотеку

@@ -63,7 +63,8 @@ namespace sr
template<class T = EF,
std::enable_if_t<std::is_nothrow_move_constructible<T>::value, int> = 0
>
scope_fail(scope_fail&& other) : m_exitFunction(std::move(other.m_exitFunction)),
scope_fail(scope_fail&& other) noexcept(std::is_nothrow_move_constructible<T>::value || std::is_nothrow_copy_constructible<T>::value)
: m_exitFunction(std::move(other.m_exitFunction)),
m_execute_on_destruction(other.m_execute_on_destruction),
m_uncaught_on_creation(uncaught_exceptions())
{
@@ -73,7 +74,8 @@ namespace sr
template<class T = EF,
std::enable_if_t<!std::is_nothrow_move_constructible<T>::value, int> = 0
>
scope_fail(scope_fail&& other) : m_exitFunction(other.m_exitFunction),
scope_fail(scope_fail&& other) noexcept(std::is_nothrow_move_constructible<T>::value || std::is_nothrow_copy_constructible<T>::value)
: m_exitFunction(other.m_exitFunction),
m_execute_on_destruction(other.m_execute_on_destruction),
m_uncaught_on_creation(other.m_uncaught_on_creation)
{

+ 4
- 2
include/scope_success.h Прегледај датотеку

@@ -58,7 +58,8 @@ namespace sr
template<class T = EF,
std::enable_if_t<std::is_nothrow_move_constructible<T>::value, int> = 0
>
scope_success(scope_success&& other) : m_exitFunction(std::move(other.m_exitFunction)),
scope_success(scope_success&& other) noexcept(std::is_nothrow_move_constructible<T>::value || std::is_nothrow_copy_constructible<T>::value)
: m_exitFunction(std::move(other.m_exitFunction)),
m_execute_on_destruction(other.m_execute_on_destruction),
m_uncaught_on_creation(uncaught_exceptions())
{
@@ -68,7 +69,8 @@ namespace sr
template<class T = EF,
std::enable_if_t<!std::is_nothrow_move_constructible<T>::value, int> = 0
>
scope_success(scope_success&& other) : m_exitFunction(other.m_exitFunction),
scope_success(scope_success&& other) noexcept(std::is_nothrow_move_constructible<T>::value || std::is_nothrow_copy_constructible<T>::value)
: m_exitFunction(other.m_exitFunction),
m_execute_on_destruction(other.m_execute_on_destruction),
m_uncaught_on_creation(other.m_uncaught_on_creation)
{

Loading…
Откажи
Сачувај