1 |
|
2 |
#include "utils/Utility.hpp" |
3 |
|
4 |
namespace oopse { |
5 |
|
6 |
bool replaceWithWildCard(std::vector<std::vector<std::string>::iterator>& cont, |
7 |
std::vector<std::string>& sequence, std::vector<std::string>& result, const std::string& wildCard) { |
8 |
if (cont.size() > sequence.size()) { |
9 |
std::cerr << "the size of iterator container is greater than the size of sequence"; |
10 |
} |
11 |
|
12 |
bool hasMoreCombination = next_combination(cont, sequence.begin(), sequence.end()); |
13 |
if (hasMoreCombination) { |
14 |
result.clear(); |
15 |
result.insert(result.begin(), sequence.size(), wildCard); |
16 |
std::vector<std::vector<std::string>::iterator>::iterator i; |
17 |
for ( i = cont.begin(); i != cont.end(); i++){ |
18 |
result[*i - sequence.begin()] = **i; |
19 |
} |
20 |
} |
21 |
|
22 |
return hasMoreCombination; |
23 |
|
24 |
}//end replaceWildCard |
25 |
|
26 |
} |