Boost logo

Boost :

Subject: Re: [boost] combinations and permutations
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-01-05 04:41:30


On 04/01/2011 16:03, Howard Hinnant wrote:

>> I need to read this through thoroughly (it looks interesting), but along the same vein, an alternative abstraction is to create a range adaptor that allows iteration through permutations and combinations of a given range. This would be more flexible than a for_each algorithm style of iteration, but possibly less efficient.
>
> I'm not positive but I suspect that a range adaptor approach would suffer precisely the same inefficiencies I've demonstrated in the next_permutation/combination algorithms: The increment operator begins to dominate as shown in the two figures. That being said, the two approaches do not have to compete. They can coexist.

You could generate the range adaptor from the for_each-style algorithm
using a coroutine ; this should have minimal overhead.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk