Skip to content

Inconsistent behavior of just and then #1645

@mpusz

Description

@mpusz

I thought that just(42) should be equivalent to stdexec::just() | stdexec::then([]{ return 42; }) but it seems they are not. The code below behaves differently for each of those. Why?

auto use = [](auto task) {
  auto work = stdexec::when_all(std::move(task), stdexec::just_error(-1));
  auto [res] = stdexec::sync_wait(std::move(work) | stdexec::upon_error([](int e){ return e; })).value();
  std::cout << "res: " << res << '\n';
};

use(stdexec::just(42)); // compiles fine
use(stdexec::just() | stdexec::then([]{ return 42; })); // ERROR :-(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions