Can any of STL algorithms/container operations like std::fill, std::transform be executed in parallel if I enable OpenMP for my compiler? I am working with
Current C++ standards don't talk about threads at all, so no. Here is more or less original statement about STL thread safety.
Look at one common (GCC) implementation of std::fill
:
template
void
fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value)
{
for ( ; __first != __last; ++__first)
*__first = __value;
}
It's obvious that it's not safe for parallel execution (which would require specialized implementation.)
And here is GCC extension for Parallel Mode.