range-v3 icon indicating copy to clipboard operation
range-v3 copied to clipboard

Is there some kind of "N-Choose-K" view in the library yet?

Open denchat opened this issue 6 years ago • 4 comments

If not, with current specs, is it possible to implement one?

I wonder wheter it should return a range of range of item references or return a range of each current combination cache of a const container?

You may tag this as a feature request.

denchat avatar Apr 07 '19 06:04 denchat

Verifying my understanding: this view would present a range of all subsequences of the underlying range with length k?

CaseyCarter avatar Apr 07 '19 17:04 CaseyCarter

Yes, all possible combinations of element with length k

Perhaps, there could be 2 versions: naive version and automatic-duplicate-filtered version

denchat avatar Apr 07 '19 20:04 denchat

I have one here: https://github.com/beojan/range-comb

beojan avatar Apr 14 '20 08:04 beojan

permutations is similar to cartesian_product (except with k copies of the same range), but there's no good substitute for combinations in range_v3 as of yet.

It would have been really useful for advent of code this year! As it is I just used cartesian_product, which is less optimal but worked.

TheThief avatar Dec 10 '20 09:12 TheThief