Metafunction
Loop
Metafunction returning a function that iterates over a static integer range.
Loop<Worker, I>::run(Arg & arg)
Include Headers
seqan/basic.h
Parameters
Worker
A worker struct. It has to implement the static (and preferably finline/inline) function body that accepts two parameters. The first one will be a reference to arg, as given to run(). The second will be the current value of the iterating variable.
I
The upper limit for the iteration.
arg
The argument to be passed into the workers' body() function.
Remarks
The loop will go from 1 up to and including I.
Examples
Print the values 1, 2, ..., I-1, I.
struct PrintWorker
{
    static inline void body(Nothing & arg, int I)
    {
        (void)arg;  // ignored
        printf("%d\n", I);
    }
};
 
Loop<PrintWorker, 10>::run(Nothing());
// This will print the numbers 1, 2, ..., 9, 10.
See Also
SeqAn - Sequence Analysis Library - www.seqan.de
 

Page built @2013/07/11 09:12:19