ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/utils/next_combination.hpp
(Generate patch)

Comparing trunk/OOPSE-3.0/src/utils/next_combination.hpp (file contents):
Revision 1676 by tim, Thu Oct 28 20:01:39 2004 UTC vs.
Revision 1677 by tim, Thu Oct 28 20:41:18 2004 UTC

# Line 35 | Line 35
35  
36   #include <vector>
37   #include <iterator>
38 <
38 > #include <iostream>
39   namespace oopse {
40  
41   /**
# Line 129 | Line 129 | bool replaceWildCard(std::vector<std::vector<std::stri
129   } //end next_combination
130  
131   bool replaceWildCard(std::vector<std::vector<std::string>::iterator>& cont,
132 <                                             std::vector<std::string> sequence, std::vector<std::string> result
133 <                                             std::string& wildCard = "X") {
134 <    if (cont.size() > sequnce.size()) {
135 <        std::cerr << "the size of iterator container is greater than the size of sequence"
132 >                                             std::vector<std::string>& sequence, std::vector<std::string>& result,
133 >                                             const std::string& wildCard = "X") {
134 >    if (cont.size() > sequence.size()) {
135 >        std::cerr << "the size of iterator container is greater than the size of sequence";
136      }
137  
138      bool hasMoreCombination = next_combination(cont, sequence.begin(), sequence.end());
139      if (hasMoreCombination) {
140 <        result.resize(sequence.size());
141 <        result.insert(result.end(), sequence.size(), wildCard);
140 >        result.clear();
141 >        result.insert(result.begin(), sequence.size(), wildCard);
142 >        std::vector<std::vector<std::string>::iterator>::iterator i;
143          for ( i = cont.begin(); i != cont.end(); i++){
144              result[*i - sequence.begin()] = **i;
145 +        }
146      }
147  
148       return hasMoreCombination;
149 +    
150   }
151  
152   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines