void set_value()

in include/unifex/repeat_effect_until.hpp [65:102]


  void set_value() noexcept {
    UNIFEX_ASSERT(op_ != nullptr);

    // This signals to repeat_effect_until the operation.
    auto* op = op_;

    UNIFEX_ASSERT(op->isSourceOpConstructed_);
    op->isSourceOpConstructed_ = false;
    op->sourceOp_.destruct();

    if constexpr (std::is_nothrow_invocable_v<Predicate&> && is_nothrow_connectable_v<Source&, type> && is_nothrow_tag_invocable_v<tag_t<unifex::set_value>, Receiver>) {
      // call predicate and complete with void if it returns true
      if(op->predicate_()) {
        unifex::set_value(std::move(op->receiver_));
        return;
      }
      auto& sourceOp = op->sourceOp_.construct_with([&]() noexcept {
          return unifex::connect(op->source_, type{op});
        });
      op->isSourceOpConstructed_ = true;
      unifex::start(sourceOp);
    } else {
      UNIFEX_TRY {
        // call predicate and complete with void if it returns true
        if(op->predicate_()) {
          unifex::set_value(std::move(op->receiver_));
          return;
        }
        auto& sourceOp = op->sourceOp_.construct_with([&] {
            return unifex::connect(op->source_, type{op});
          });
        op->isSourceOpConstructed_ = true;
        unifex::start(sourceOp);
      } UNIFEX_CATCH (...) {
        unifex::set_error(std::move(op->receiver_), std::current_exception());
      }
    }
  }