Do the parallel versions of search algorithms in the STL (e.g. std::find, std::find_if) guarantee to return iterators to the first element in the range matching the criterion?
The documentation makes no explicit reference to whether this is the case - and in 'C++ Concurrency in Action' there is an implementation that specifically does not return the first element.
The behaviour of standard library algorithms* such as std::find
, std::find_if
is well specified in the C++ standard. As of C++14, there are no exceptions to the specified behaviour for parallel algorithms. This means that hypothetical parallel implementations still need to respect these requirements in order to be compliant.
* From comments, OP means the C++ standard library, and not the Standard Template Library. I make the distinction because the STL may well define a different set of rules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With