Hi, Is there an available function to generate all the i-tuples among a sequence of size n (runtime) and 1<= i <=n For e.g. in a vector of 3 ints 1 2 and 3 we want to get all of the singletons: 1 2 3 all the pairs 1 2 1 3 2 3 and all the triplets 1 2 3 If not and I were to write one (n known at runtime only), what signature should I use? template <typename iterator> .... combinations(iterator begin, iterator end) { } what return type would hold all of the singletons, pairs, triplets, ... n-tuples Perhaps a better signature is template <typename iterator> .... combinations(iterator begin, iterator end, int i) { } but then the return type is still not easy to define. I'm thinking a 2D multi_array where not all the space is used (dim1 size is 2^n and dim2 size is n), and pass it by ref template <typename iterator> void combinations(multi_array& out, iterator begin, iterator end) { } regards,