3.5.4. io.hpp

Full path: permutation/io.hpp

std::vector<std::vector<std::size_t>> read_permutation_cycles(std::istream &s)
Returns

a list of cycles of non-negative numbers parsed from the given stream. It does not necessarily represent a permutation (see the other overload).

Throws

io_error on parsing errors.

template<typename Perm>
void read_permutation_cycles(std::istream &s, Perm &p, std::size_t n)
template<typename Perm>
void read_permutation_cycles(std::istream &s, Perm &p)
template<typename Perm>
void read_permutation_cycles(const std::string &s, Perm &p, std::size_t n)
template<typename Perm>
void read_permutation_cycles(const std::string &s, Perm &p)

Parse a permutation in cycle notation from a stream or a string (s) and store it in p. Permutations are zero-indexed.

The overloads without n requires SizeAwarePermutation<Perm>, and sets n = perm_group::degree(p).

Throws

io_error if parsing fails.

Throws

io_error if a number is n or higher.

Throws

io_error if the data does not represent a permutation.

template<typename Perm>
std::ostream &write_permutation_cycles(std::ostream &s, const Perm &p, std::size_t n)

Write a permutation in cycle notation.

template<typename Perm>
std::ostream &write_permutation_cycles(std::ostream &s, const Perm &p)

Requires DegreeAwarePermutation<Perm>.

Write a permutation in cycle notation.