From b2bcfce95a059e581813fd8fc786ce39ba780833 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Mon, 24 Dec 2018 18:34:42 +0100 Subject: [PATCH] More noexcept specifiers --- src/cpp-utils/either.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cpp-utils/either.h b/src/cpp-utils/either.h index 06c7d28d..b61eb649 100644 --- a/src/cpp-utils/either.h +++ b/src/cpp-utils/either.h @@ -12,13 +12,13 @@ namespace cpputils { class either final { public: template::value && !std::is_constructible::value>* = nullptr> - either(Head&& construct_left_head_arg, Tail&&... construct_left_tail_args) /* TODO noexcept(noexcept(std::declval>()._construct_left(std::forward(construct_left_head_arg), std::forward(construct_left_tail_args)...))) */ + either(Head&& construct_left_head_arg, Tail&&... construct_left_tail_args) noexcept(noexcept(std::declval>()._construct_left(std::forward(construct_left_head_arg), std::forward(construct_left_tail_args)...))) : _side(Side::left) { _construct_left(std::forward(construct_left_head_arg), std::forward(construct_left_tail_args)...); } template::value && std::is_constructible::value>* = nullptr> - either(Head&& construct_right_head_arg, Tail&&... construct_right_tail_args) /* TODO noexcept(noexcept(std::declval>()._construct_right(std::forward(construct_right_head_arg), std::forward(construct_right_tail_args)...))) */ + either(Head&& construct_right_head_arg, Tail&&... construct_right_tail_args) noexcept(noexcept(std::declval>()._construct_right(std::forward(construct_right_head_arg), std::forward(construct_right_tail_args)...))) : _side(Side::right) { _construct_right(std::forward(construct_right_head_arg), std::forward(construct_right_tail_args)...); } @@ -33,7 +33,7 @@ namespace cpputils { } } - either(either &&rhs) /* TODO noexcept(noexcept(_construct_left(std::move(rhs._left))) && noexcept(_construct_right(std::move(rhs._right)))) */ + either(either &&rhs) noexcept(noexcept(_construct_left(std::move(rhs._left))) && noexcept(_construct_right(std::move(rhs._right)))) : _side(rhs._side) { if(_side == Side::left) { _construct_left(std::move(rhs._left)); @@ -47,7 +47,7 @@ namespace cpputils { } //TODO Try allowing copy-assignment when Left/Right types are std::is_convertible - either &operator=(const either &rhs) /* TODO noexcept(noexcept(_construct_left(rhs._left)) && noexcept(_construct_right(rhs._right))) */ { + either &operator=(const either &rhs) noexcept(noexcept(_construct_left(rhs._left)) && noexcept(_construct_right(rhs._right))) { _destruct(); _side = rhs._side; if (_side == Side::left) { @@ -58,7 +58,7 @@ namespace cpputils { return *this; } - either &operator=(either &&rhs) /* TODO noexcept(noexcept(_construct_left(std::move(rhs._left))) && noexcept(_construct_right(std::move(rhs._right)))) */ { + either &operator=(either &&rhs) noexcept(noexcept(_construct_left(std::move(rhs._left))) && noexcept(_construct_right(std::move(rhs._right)))) { _destruct(); _side = rhs._side; if (_side == Side::left) { @@ -163,10 +163,10 @@ namespace cpputils { } template - friend either make_left(Args&&... args) /* TODO noexcept(noexcept(std::declval>()._construct_left(std::forward(args)...)))*/; + friend either make_left(Args&&... args) /* TODO noexcept(noexcept(std::declval>()._construct_left(std::forward(args)...))) */; template - friend either make_right(Args&&... args) /* TODO noexcept(noexcept(std::declval>()._construct_right(std::forward(args)...)))*/; + friend either make_right(Args&&... args) /* TODO noexcept(noexcept(std::declval>()._construct_right(std::forward(args)...))) */; }; template