30 #ifndef SECURE_PERMUTATION_IMPLEMENTATION_GUARD
31 #define SECURE_PERMUTATION_IMPLEMENTATION_GUARD
40 template <
typename T_DataType>
43 throw std::runtime_error(
"The input vector doesn't have the expected size.");
46 for (PermutationVector::const_iterator permutation =
permutations.begin(); permutation !=
permutations.end(); ++permutation) {
47 std::swap(vector[permutation->first], vector[permutation->second]);
56 template <
typename T_DataType>
59 throw std::runtime_error(
"The input vector doesn't have the expected size.");
62 for (PermutationVector::const_reverse_iterator permutation =
permutations.rbegin(); permutation !=
permutations.rend(); ++permutation) {
63 std::swap(vector[permutation->first], vector[permutation->second]);
70 #endif//SECURE_PERMUTATION_IMPLEMENTATION_GUARD
void InvertPermutation(T_DataType &vector) const
Applies the permutations in reverse to the input verctor.
PermutationVector permutations
The vector of permutations.
void Permute(T_DataType &vector) const
Applies the permutations to the input vector.
const size_t vectorSize
The size of the vectors that can be permuted.