Hi, I'm a beginner with intel TBB and to understand the principles of parallel_reduce a tried a simple maximum search on a ten-elements vector. Strangely the results I get are sometimes false (on the same entry I can have either the max or the second with about the same probability) I don't get what I messed up and I think that I missed an important point. Could you please take a look. Thank you in advance Alex
Have you studied the examples in the Tutorial? In both constructors, initialise the member variables to neutral values. You must also not assume that operator() is called exactly once for Max: assume it already contains an intermediate result from any number of previous calls. Note that I have not verified the rest of the code, but this should already make a difference.