Skip to content

[BUG] Arguments are passed by value #83

@ThibaultDECO

Description

@ThibaultDECO

It would be useful to specify in the documentation that, when submitting tasks, arguments are passed by value by default (see std::bind()), which can significantly slow down the pool.

And that one should use std::ref() to pass arguments by reference, such as:
auto my_future = pool.submit(task, arg1, std::ref(arg2));

It would be convenient if there was a way for arguments to be passed by reference automatically when the function definition specifies it, but not sure how to do it.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions