Open koonpeng opened 1 year ago
This is a preview of the work in removing exceptions.
Inspired from rust, Result<T> is the alternative to exceptions. Internally it uses std::variant to store either the result or a std::exception.
Result<T>
std::variant
std::exception
[[nodiscard]]
Result<void>
std::optional
Result<T&>
Integration test is working with the latest release of ros2 iron, but the docker images are not updated yet.
Could you merge the latest main into the base branch also rebase/update this branch?
This is a preview of the work in removing exceptions.
Inspired from rust,
Result<T>
is the alternative to exceptions. Internally it usesstd::variant
to store either the result or astd::exception
.[[nodiscard]]
should almost always be used when returningResult<T>
. We don't have custom lint rules so it will have to be checked manually.Result<void>
is a special case that usingstd::optional
instead.Result<T&>
does not work becausestd::variant
cannot contain references.Result<T>
for all reference types and store a pointer internally instead.