About parameters InputIterator first
InputIterator first for the initial position of the range which is included in the range. InputIterator last
InputIterator last for the final position which it not included in the range.
A sample program to generate all permutations
using namespace std;
cout << "Enter the string : ";
cin >> s;
sort(s.begin(),s.end()); //we have to sort before to generate all permutations
//Printing all the permutation of a range
cout << "Permutations of the above string " << endl;
cout << s << endl;
Output of the above program
Enter the string : abcd
Permutations of the above string
Time complexity for next_permutation is up to linear in half the distance in the range.