#include
<algorithm>
bool is_permutation (For first, For last, For2 first2) bool is_permutation (For first, For last, For2 first2, Binary comp) bool is_permutation (For first, For last, For2 first2, For2 last2) bool is_permutation (For first, For last, For2 first2, For2 last2, Binary comp) bool ranges::is_permutation (Range1 r1, Range2 r2, Binary comp = {}, Proj1 proj1 = {}, Proj2 proj2 ={}) bool ranges::is_permutation (For first, For last, For2 first2, For2 last2, Binary comp = {}, Proj1 proj1 = {}, Proj2 proj2 ={})
Prüft, ob [first2,…) eine Permutation des Bereiches [first,last) darstellt.
first | Anfang des Bereiches |
last | Ende des Bereiches |
first2 | Anfang des anderen Bereiches |
last2 | Ende des anderen Bereiches |
comp | Vergleichskriterium (Vorgabe = less ) |
proj | einstelliger Funktor (Vorgabe = std::identity ) |
Rückgabewert: true
, falls die Bereiche durch Permutation ineinander überführbar sind.
#include <algorithm> #include <iostream> #include <string> int main() { std::string s = "THELAW", s2 = "WEALTH"; std::cout << s << " ./. " << s2 << " : " << std::is_permutation(begin(s), end(s), begin(s2)) << '\n'; }