--- trunk/OOPSE-2.0/src/utils/next_combination.hpp 2004/10/28 19:06:59 1674
+++ trunk/OOPSE-2.0/src/utils/next_combination.hpp 2004/10/28 19:33:46 1675
@@ -44,14 +44,14 @@ template Preconditions:
*
*/
-template > class IteratorContainer>
-bool next_combination(IteratorContainer& iterContainer, BidirectionalIterator first, BidirectionalIterator last) {
+template > class IteratorContainer>
+bool next_combination(IteratorContainer& iterContainer, RandomAccessIterator first, RandomAccessIterator last) {
if (first == last) {
return false;
}
- BidirectionalIterator endIter = --last;
- typename IteratorContainer::iterator i = iterContainer.end();
+ RandomAccessIterator endIter = --last;
+ typename IteratorContainer::iterator i = iterContainer.end();
if (iterContainer.empty()) {
//if sequence is empty, we insert the first iterator
@@ -71,14 +71,14 @@ bool next_combination(IteratorContainer::iterator j = i;
+ typename IteratorContainer::iterator j = i;
j--;
while( j >= iterContainer.begin() && *i == *j + 1){
i--;
j--;
};
- BidirectionalIterator biDirIter;
+ RandomAccessIterator raIter;
if (j - iterContainer.begin() < 0) { //reaches the last combination of current size
//half open range
if (last - first + 1 == iterContainer.size()) {
@@ -88,20 +88,20 @@ bool next_combination(IteratorContainer