cds  2.3.2
cds::opt::permutation_generator< Generator > Struct Template Reference

[type-option] Random permutation generator option setter More...

#include <cds/opt/permutation.h>

Detailed Description

template<typename Generator>
struct cds::opt::permutation_generator< Generator >

[type-option] Random permutation generator option setter

The class represents permutation generator of unique integers from [0, nLength) (nLenght is not included) in random order.

The generator interface is:

class generator {
// Initializes the generator of length nLength
generator( size_t nLength );
// Returns current value
operator int();
// Goes to next value. Returns false if the permutation is exchausted
bool next();
// Resets the generator to produce the new sequence
void reset();
};

Usage example

The permutation generator is intended for do {} while loop:

permutation_generator gen( 16 );
int i = gen.begin();
do {
int i = gen;
//...
} while ( gen.next());
// Get other permutation
gen.reset();
do {
int i = gen;
//...
} while ( gen.next());

The following Generator defined:


The documentation for this struct was generated from the following file:

cds 2.3.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:50 by Doxygen 1.8.13