Currently I am trying to generate combinations from a vector that contains some integers. For now I want it to print out all of the combinations that are of length to_genera
The second template argument shouldn't be bool
. You can allow compiller to handle types and simply write:
while(next_combination(combo.begin(), combo.begin() + to_generate, combo.end(), std::less<int>()))
for(std::vector<int>::iterator iter = combo.begin(); iter != combo.end() ; ++iter)
std::cout << *iter << " ";
And use spaces - it makes code look better.