void ForEachColumnSetPolicy | ( | FunctorType && | fn, |
Args... | args | ||
) | const |
Performs parallel policy-based enumeration of columns of a matrix calling a client's Callable object.
FunctorType | A type of the client's Callable object, i.e. a function, a pointer to function, a method, a lambda, etc. Since ForEachColumnSetPolicy passes an additional argument to the callable, the type cannot be a class data member. See fn description for the requirements. |
Args... | A type pack of additional arguments passed directly to the callable object starting from the second parameter position. See fn description below. |
ParallelismPolicy | A policy marker specifying whether the enumeration should be performed in multiply CPU threads. Possible values are matrix_always_sequential and matrix_always_parallel (but not matrix_dynamically_customizable_parallelism). |
fn | is a Callable object passed to the method by a client. The object, of type FunctorType , is expected to process the columns independently of one another both in parallel and in sequential mode, since the order of calls to the object is unspecified. The scheme of calling the object is given in the description of Callable. Additionally, the first parameter passed by the implementation of ForEachColumnSetPolicy to fn is an index if a column to process. I.e. the calls are made in the following forms. std::forward<FunctorType>(fn)(iColumn, std::forward<Args>(args)...); //for a function object
(std::forward<Arg1>(arg1).*fn)(iColumn, std::forward<Args2_n>(args2_n)...); //for a pointer to a method of a class object arg1 of type Arg1 where
//Arg1 is the first type of the pack Args, arg1 is the corresponding parameter; Args2_n - types of the pack Args excluding the first one, args2_n
//is a corresponding pack of arguments.
(arg1.get().*fn)(iColumn, std::forward<Args2_n>(args2_n)...); //The same, but if Arg1 is std::reference_wrapper
iColumn is an index of a column being enumerated, and args is a pack of parameters given by the client as the second parameter of the ForEachColumnSetPolicy method with respect to the Args type pack. The integral iColumn is of the size_type type. |
args | is a parameter pack for the callable fn defined by the client. |
Unlike ForEachColumn, the method enumerates the columns of the matrix using a specifically provided policy.
std::system_error | Any of the parallel threads could not be started. |