...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::compute::next_permutation — Permutation generating algorithm.
// In header: <boost/compute/algorithm/next_permutation.hpp> template<typename InputIterator> bool next_permutation(InputIterator first, InputIterator last, command_queue & queue = system::default_queue());
Transforms the range [first, last) into the next permutation from the set of all permutations arranged in lexicographic order Space complexity: \Omega(1)
Parameters: 


Returns: 
Boolean value signifying if the last permutation was crossed and the range was reset 