|
tgen
|
Permutation value. More...

Public Member Functions | |
| value (const std::vector< int > &vec) | |
| Creates a permutation value from a std::vector. | |
| int | size () const |
| Returns the size of the permutation value. | |
| const int & | operator[] (int idx) const |
| Returns the value at some position of the value. | |
| int | parity () const |
| Parity of the permutation. | |
| value & | sort () |
| Sorts the value in non-decreasing order. | |
| value & | reverse () |
| Reverses the value. | |
| value & | inverse () |
| Inverse of the permutation. | |
| value & | separator (char sep) |
| Sets separator for printing. | |
| value & | add_1 () |
| Adds 1 for printing. | |
| std::vector< int > | to_std () const |
| Converts the value to a std::vector. | |
| Public Member Functions inherited from tgen::gen_value_base< value > | |
| bool | operator< (const value &rhs) const |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const value &inst) |
| Prints the value to a std::ostream. | |
Permutation value.
It can be deterministically operated upon and printed through std::cout.
|
inline |
Creates a permutation value from a std::vector.
| vec | The std::vector representing the value. |
|
inline |
Adds 1 for printing.
This makes it so, when given to std::cout, the permutation will be printed as 1-based.
O(1).
|
inline |
Inverse of the permutation.
The inverse of the permutation p is another pi such that pi[p[i]] = p[pi[i]] = i.
O(n).
|
inline |
Returns the value at some position of the value.
| idx | Index to be accessed. |
|
inline |
Parity of the permutation.
|
inline |
Reverses the value.
O(n).
|
inline |
Sets separator for printing.
O(1).
|
inline |
Returns the size of the permutation value.
|
inline |
Sorts the value in non-decreasing order.
O(n).
|
inline |
Converts the value to a std::vector.
|
friend |
Prints the value to a std::ostream.
The values are printed with one space as a separator by default, and with no end of line.