In our previous episode, Michael Schnell said:
> Some c++11 code doing parallel execution:
>
> *
> void f(vector<double>&);
>
> struct F {
> vector<double>& v;
> F(vector<double>& vv) :v{vv} { }
> void operator()();
> };
>
> int main()
> {
> std::thread t1{std::bind(f,some_vec)}; //*f(some_vec) executes
> in separate thread*
> std::thread t2{F(some_vec)}; //*F(some_vec)()
> executes in separate thread*
>
> t1.join();
> t2.join();
> }
I'm no C++ expert, but:
Where is the parallel aspect? It looks more like a shorthand to spawn a
thread to evaluate an expression/closure/function call, and then wait on it
using .join().
The "closure"-like aspect (be able to pass expressions to be evaluated
somewhere else) looks like a bigger feature then that threads are now
grouped under namespace std.
I'm note sure we are actually witnessing something like the parallel for you
talked about earlier? Are you sure?
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel