void set_value()

in include/unifex/finally.hpp [90:123]


      void set_value() && noexcept {
        auto* const op = op_;

        using completion_value_op_t = connect_result_t<CompletionSender, value_receiver>;
        unifex::deactivate_union_member<completion_value_op_t>(op->completionValueOp_);

        UNIFEX_TRY {
          // Move the stored values onto the stack so that we can
          // destroy the ones stored in the operation-state. This
          // prevents the need to add a big switch to the operation
          // state destructor to determine which value-tuple type
          // destructor needs to be run.
          auto values = [op]() -> std::tuple<Values...> {
            scope_guard g{[op]() noexcept {
              unifex::deactivate_union_member<std::tuple<Values...>>(op->value_);
            }};
            return static_cast<std::tuple<Values...>&&>(
              op->value_.template get<std::tuple<Values...>>());
          }
          ();

          std::apply(
              [&](Values&&... values) {
                unifex::set_value(
                    static_cast<Receiver&&>(op->receiver_),
                    static_cast<Values&&>(values)...);
              },
              static_cast<std::tuple<Values...>&&>(values));

        } UNIFEX_CATCH (...) {
          unifex::set_error(
              static_cast<Receiver&&>(op->receiver_), std::current_exception());
        }
      }