I need to take all possible unique combinations of 3 elements in a vector. std::next_permutation
works, but it gives me lot of duplicates.
For example
(1, 2, 3, 4, 5) and (1, 2, 3, 5, 4)
first 3 elements that I take are equal, so I'm doing redundant work. Is there any efficient way of iterating through the unique combinations?