CGAL 6.0 - Geometric Object Generators
Loading...
Searching...
No Matches
Generator/combination_enumerator.cpp
#include "CGAL/Combination_enumerator.h"
#include <iostream>
using namespace std;
int main()
{
unsigned int n(0);
const int k(3), first(10), last(15);
cout << "Taking " << k << " distinct integers in the range [" <<
first << ", " << last << "]:";
CGAL::Combination_enumerator<int> combi(k, first, last + 1);
while( ! combi.finished() ) {
cout << " {";
for(int i = 0; i < k; ++i) {
cout << combi[i];
if( i < k - 1 )
cout << ' ';
}
cout << '}';
++n;
++combi;
}
cout << endl << "Enumerated " << n << " combinations." << endl;
return EXIT_SUCCESS;
}
The class Combination_enumerator is used to enumerate all fixed-size combinations (subsets) of a sour...
Definition: Combination_enumerator.h:21
bool finished()
Returns true if and only if all combinations have been enumerated.
STL namespace.