Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::util::Permutations< T > Class Template Reference

#include <permutations.h>

Public Member Functions

 Permutations (std::span< T > values, size_t r)
 
bool next ()
 
auto begin () const
 
auto end () const
 

Detailed Description

template<typename T>
class inviwo::util::Permutations< T >

Generate all the successive r length permutations of the elements in values

See also
https://docs.python.org/3/library/itertools.html#itertools.permutations

Example:

std::array values = {0, 1, 2};
util::Permutations perm(std::span{values}, 2);
do {
for (auto v : perm) {
std::cout << v << " ";
}
std::cout << "\n";
} while (perm.next());
Definition permutations.h:72

The documentation for this class was generated from the following file: