Closed danieleades closed 7 months ago
You might have to roll your own solution (if you did not already did) but as I know the internal well enough after contributing to it, maybe this is simple/general enough.
First, what do you mean by early? Just to avoid to allocate each item to a vector but still going through them one by one? Or early knowing the X next items would be wrong? Something else?
There is tuple_combinations
too, which has really different internals.
This might be specific enough that i need to roll my own solution, but here goes.
I have a set of objects from which i need to iterate over all possible combinations. The
combinations
iterator is perfect, except...basically i want to be able to use a predicate to prune combinations early. If I add the pruning step after the
combinations
function then it is prohibitively expensive to count the combinations, even if the total number of valid combinations is very small