Standard C++ Library Class Reference
 prev_m2.end(),less<int>());
  next_permutation(next_m2.begin(), 
 next_m2.end(),less<int>());
 //Output results
 cout << "Example 1: " << endl << " ";
 cout << "Original values: ";
 copy(m1.begin(),m1.end(),
 ostream_iterator<int>(cout," "));
 cout << endl << " ";
 cout << "Previous permutation: ";
 copy(prev_m1.begin(),prev_m1.end(),
 ostream_iterator<int>(cout," "));
 cout << endl<< " ";
 cout << "Next Permutation: ";
 copy(next_m1.begin(),next_m1.end(),
 ostream_iterator<int>(cout," "));
 cout << endl << endl;
 cout << "Example 2: " << endl << " ";
 cout << "Original values: ";
 copy(m2.begin(),m2.end(),
 ostream_iterator<char>(cout," ")); 
 cout << endl << " ";
 cout << "Previous Permutation: ";
 copy(prev_m2.begin(),prev_m2.end(),
 ostream_iterator<char>(cout," "));
 cout << endl << " ";
 cout << "Next Permutation: ";
 copy(next_m2.begin(),next_m2.end(),
 ostream_iterator<char>(cout," ")); 
 cout << endl << endl;
 return 0;
 }
Output : 
Example 1:
 Original values: 0 0 0 0 1 0 0 0 0 0
 Previous permutation: 0 0 0 0 0 1 0 0 0 0
 Next Permutation: 0 0 0 1 0 0 0 0 0 0
Example 2:
 Original values: a b c d e f g h j i
 Previous Permutation: a b c d e f g h i j
 Next Permutation: a b c d e f g i h j










