Listing specific subsets using STL
问题 Say I have a range of number, say {2,3,4,5}, stored in this order in a std::vector v , and that I want to list all possibles subsets which end with 5 using STL... that is : 2 3 4 5 2 3 5 2 4 5 3 4 5 2 5 3 5 4 5 5 ( I hope i don't forget any:) ) I tried using while(next_permutation(v.begin(),v.end())) but didn't come up with the wanted result :) Does anyone have an idea? PS : those who have done the archives of google code jam 2010 may recognize this :) 回答1: tomasz describes a solution which