-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iox-1751 Add equality operators for expected
and variant
#1757
iox-1751 Add equality operators for expected
and variant
#1757
Conversation
ee3940c
to
b63a604
Compare
Codecov Report
@@ Coverage Diff @@
## master #1757 +/- ##
==========================================
- Coverage 77.39% 77.35% -0.05%
==========================================
Files 366 366
Lines 14196 14230 +34
Branches 1983 1991 +8
==========================================
+ Hits 10987 11007 +20
- Misses 2583 2591 +8
- Partials 626 632 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content-wise this PR makes sense but why do we add the comparison feature? Autosar states that when one implements comparison operators one should implement them as free functions. But there is nowhere stated that they have to be implemented at all.
So why add them now?
@elfenpiff You are right that we currently don't use these operators in |
/// @param[in] rhs right side of the comparision | ||
/// @return true if the expecteds are equal, otherwise false | ||
template <typename ErrorType> | ||
constexpr bool operator==(const expected<ErrorType>& lhs, const expected<ErrorType>& rhs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you forgot noexcept
here and in the other operator implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think equality operators can't be noexcept
in this case as we call the equality operator of an underlying type inside the expected
. Also in case of the variant
the if (N != index)
it could lead to an Expects
call which could throw in future if configured that way by the user.
iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/variant_internal.hpp
Outdated
Show resolved
Hide resolved
089b7ec
to
4ca226d
Compare
iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/variant_internal.hpp
Outdated
Show resolved
Hide resolved
eb19aa0
to
06a7352
Compare
06a7352
to
c861bb9
Compare
Signed-off-by: Simon Hoinkis <[email protected]>
Signed-off-by: Simon Hoinkis <[email protected]>
Signed-off-by: Simon Hoinkis <[email protected]>
Signed-off-by: Simon Hoinkis <[email protected]>
0956f1c
c861bb9
to
0956f1c
Compare
Pre-Review Checklist for the PR Author
iox-123-this-is-a-branch
)iox-#123 commit text
)task-list-completed
)iceoryx_hoofs
are added to./clang-tidy-diff-scans.txt
Notes for Reviewer
expected
andvariant
Checklist for the PR Reviewer
iceoryx_hoofs
have been added to./clang-tidy-diff-scans.txt
Post-review Checklist for the PR Author
References
cxx::variant
andcxx::expected
#1751