Template Function sequant::for_each

Function Documentation

template<typename SizedRange, typename UnaryOp>
void sequant::for_each(SizedRange &rng, const UnaryOp &op)

Parallel version of std::for_each , using either parallel C++ algorithms or manual threaded implementation with at most nthreads instances executing concurrently, where nthreads is the value returned by get_num_threads() .

See also

get_num_threads()

Note

The load is balanced dynamically.

Template Parameters:
  • SizedRange – a sied range

  • UnaryOp – a function type for which Lambda(int) is valid

Parameters:
  • rng – the SizedRange object

  • op – the function object to execute, each will be invoked as op(std::advance(begin(rng) + task_id)) where task_id is an integer in [0,size(rng)) . op(t1) will be commenced not after op(t2) if t1<t2 .