Skip to content

Should stdexec::spawn accept an lvalue scope token? #1963

@gamecentric

Description

@gamecentric

Hi,
it seems that spawn accepts only rvalue scope tokens:

counting_scope scope;
spawn(just(), scope.get_token()); // ok

auto token = scope.get_token();
spawn(just(), token); // error: counting_scope::token& does not satisfy the scope_token concept
spawn(just(), std::move(token)); // ok

Scope tokens are required to copiable and all token types in the C++ standard are usually expected to be cheaply copiable. In the specific case of counting_scope::token it's just a pointer to the scope. Thus the restriction seems quite unnatural.

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