Boost logo

Boost :

From: Ben Bear (benbearchen_at_[hidden])
Date: 2006-09-15 09:09:49

Hi, all!

I wrote a proposal for TR2 about add combination against
std::permutation. It's here:

And the source code:

I need HELP! Because my bad ability in English, can anybody edit
this report? And can anybody commit this proposal to WG21?

One year ago, I wrote a email to the libstdc++ group for the
combination, and they said that I should commit this to the Boost. I
wrote a email to this mailing list one month ago, but nobody replies me.
Maybe I should write the proposal for TR2. Now I wrote a draft.

Because the combination and the permutation are a pair in the
Mathematics. So it's needed to provide combination against the

I have implemented the combination for several years. Now, I think my
implementation is very pithy and is parallel to the permutation's

The difference between combination and permutation is that combination
needs initialization functions and the elements are divided into two
ranges, selected and unselected. The combination is several times
slow than the permutation.


// select two number from {0, 1, 2, 3, 4}
int a[5] = {0, 1, 2, 3, 4};
init_combination (a, a+2, a+5);
  cout << a[0] << " " << a[1] << endl;
while (next_combination (a, a+2, a+5));

The result is:
0 1
0 2
0 3
0 4
1 2
1 3
1 4
2 3
2 4
3 4


Ben Bear in Guangzhou, China

Boost list run by bdawes at, gregod at, cpdaniel at, john at