Skip to content

Commit 44e9d98

Browse files
authored
refactor: add more noexcept specifiers to Result class
1 parent 4dd330b commit 44e9d98

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

include/common/result.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Result {
4848
* - T must be constructible with perfectly forwarded value argument
4949
*/
5050
template<typename U>
51-
// TODO: figure out correct noexcept specifier
51+
noexcept(std::nothrow_constructible_from_v<T, U&&>)
5252
requires std::constructible_from<T, U&&>
5353
constexpr Result(U&& value)
5454
: value(std::forward<U>(value)) {}
@@ -78,7 +78,7 @@ class Result {
7878
* - T must be constructible with perfectly forwarded value argument
7979
*/
8080
template<typename U>
81-
// TODO: figure out correct noexcept specifier
81+
noexcept(std::nothrow_constructible_from_v<T, U&&>)
8282
requires std::constructible_from<T, U&&>
8383
constexpr Result(E error, U&& value)
8484
: error(error),
@@ -121,8 +121,7 @@ class Result {
121121
* @return "normal" value
122122
*/
123123
template<typename Self>
124-
// TODO: figure out correct noexcept specifier
125-
constexpr auto get_value(this Self&& self) {
124+
constexpr auto get_value(this Self&& self) noexcept(noexcept(std::forward<Self>(self).value)) {
126125
return std::forward<Self>(self).value;
127126
}
128127

0 commit comments

Comments
 (0)