#pragma once namespace pfc { PFC_DECLARE_EXCEPTION( exception_invalid_permutation, exception_invalid_params, "Invalid permutation" ); t_size permutation_find_reverse(t_size const * order, t_size count, t_size value); //! For critical sanity checks. Speed: O(n), allocates memory. bool permutation_is_valid(t_size const * order, t_size count); //! For critical sanity checks. Speed: O(n), allocates memory. void permutation_validate(t_size const * order, t_size count); //! Creates a permutation that moves selected items in a list box by the specified delta-offset. void create_move_items_permutation(t_size * p_output,t_size p_count,const class bit_array & p_selection,int p_delta); void create_move_item_permutation( size_t * p_output, size_t p_count, size_t from, size_t to ); } class order_helper { pfc::array_t m_data; public: order_helper(t_size p_size) { m_data.set_size(p_size); for(t_size n=0;n static bool g_is_identity(const t_array & p_array) { const t_size count = pfc::array_size_t(p_array); for(t_size walk = 0; walk < count; ++walk) if (p_array[walk] != walk) return false; return true; } template static void g_fill(t_int * p_order,const t_size p_count) { t_size n; for(n=0;n static void g_fill(t_array & p_array) { t_size n; const t_size max = pfc::array_size_t(p_array); for(n=0;n