jobq | Simple job queue management | Job Scheduling library
kandi X-RAY | jobq Summary
kandi X-RAY | jobq Summary
Simple job queue management (a better 'batch')
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of jobq
jobq Key Features
jobq Examples and Code Snippets
Community Discussions
Trending Discussions on jobq
QUESTION
I am trying to get a thread pool to run a method were the arguments are passed by reference. The method I want to run is:
void Foo(const std::vector &arg1, std::vector &arg2, int size) {//modify elements of arg2}
I am submitting this function to a thread pool:
...ANSWER
Answered 2021-Apr-23 at 03:13According to std::bind
documentation:
The return type of
std::bind
holds a member object of typestd::decay::type
constructed fromstd::forward(f)
, and one object per each ofargs...
, of typestd::decay::type
, similarly constructed fromstd::forward(arg_i)
.
Thanks to decay
, the arguments are "stored-by-value", which means the arguments are either copy-constructed or move-constructed. This explains their different address.
As usually in such situations, the solution is in using std::reference_wrapper
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install jobq
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page