1bool next_permutation(BidirectionalIterator first, BidirectionalIterator last);
2bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
3
4//Example:
5 int a[]={1,2,3,4};
6 do {
7 for(auto& i : a) cout<<i<<" ";
8 cout<<endl;
9 } while (next_permutation(a,a+4));