stringや他のコンテナの全ての順列を生成する。
#include <algorithm> ... string str = "ABCDEF"; do { cout << str << endl; } while(next_permutation(str.begin(), str.end())); Result: ABCDEF ABCDFE ABCEDF ABCEFD ... FEDCBA (計 6! = 720個の文字列を生成)