← comparison
tgen
Loading...
Searching...
No Matches
Pairs

Generation of pairs of integral types. More...

Classes

struct  tgen::pair< T >
 Pair generator. More...
struct  tgen::pair< T >::value
 Pair value. More...

Detailed Description

Generation of pairs of integral types.

Examples

Prints 10 different pairs of values from 1 to n, with first <= second.

const int n = 100;
std::cout <<
tgen::pair<int>(1, n).leq().distinct().gen_list(10).separator('\n') << std::endl;
auto distinct(Args &&...args) const
Creates distinct generator for current generator.
Definition tgen.h:440
Pair generator.
Definition tgen.h:4137
pair & leq()
Restricts generator s.t. first is less than or equal to second.
Definition tgen.h:4182
67 79
15 98
51 72
42 90
49 69
22 40
20 72
70 71
42 87
75 93

All pairs (a, b) in [1, 3] with a <= b.

std::cout << tgen::pair<int>(1, 3).leq().distinct().gen_all().separator('|') << std::endl;
1 3|1 2|3 3|1 1|2 2|2 3