File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212#include < string>
1313#include < type_traits>
1414
15+ #include " internal/ptr_cast.hpp"
16+
1517namespace rfl {
1618
1719// / Defines the error class to be returned when something went wrong
@@ -398,27 +400,25 @@ class Result {
398400 }
399401
400402 T&& get_t () && noexcept {
401- return std::move (*std::launder ( reinterpret_cast <T*>(t_or_err_.data () )));
403+ return std::move (*internal::ptr_cast <T*>(t_or_err_.data ()));
402404 }
403405
404- T& get_t () & noexcept {
405- return *std::launder (reinterpret_cast <T*>(t_or_err_.data ()));
406- }
406+ T& get_t () & noexcept { return *internal::ptr_cast<T*>(t_or_err_.data ()); }
407407
408408 const T& get_t () const & noexcept {
409- return *std::launder ( reinterpret_cast <const T*>(t_or_err_.data () ));
409+ return *internal::ptr_cast <const T*>(t_or_err_.data ());
410410 }
411411
412412 Error&& get_err() && noexcept {
413- return std::move (*std::launder ( reinterpret_cast <Error*>(t_or_err_.data () )));
413+ return std::move (*internal::ptr_cast <Error*>(t_or_err_.data ()));
414414 }
415415
416416 Error& get_err () & noexcept {
417- return *std::launder ( reinterpret_cast <Error*>(t_or_err_.data () ));
417+ return *internal::ptr_cast <Error*>(t_or_err_.data ());
418418 }
419419
420420 const Error& get_err () const & noexcept {
421- return *std::launder ( reinterpret_cast <const Error*>(t_or_err_.data () ));
421+ return *internal::ptr_cast <const Error*>(t_or_err_.data ());
422422 }
423423
424424 void move_from_other (Result<T>& _other) noexcept {
You can’t perform that action at this time.
0 commit comments