2 PFC_DECLARE_EXCEPTION( exception_invalid_permutation, exception_invalid_params,
"Invalid permutation" );
20 for(
t_size n=0;n<p_size;n++) m_data[n]=n;
26 for(
t_size walk = 0; walk < count; ++walk) {
27 if (order[walk] != walk)
return false;
31 template<
typename t_array>
static bool g_is_identity(
const t_array & p_array) {
33 for(
t_size walk = 0; walk < count; ++walk)
if (p_array[walk] != walk)
return false;
37 template<
typename t_
int>
39 t_size n;
for(n=0;n<p_count;n++) p_order[n] = (
t_int)n;
42 template<
typename t_array>
43 static void g_fill(t_array & p_array) {
45 for(n=0;n<max;n++) p_array[n] = n;
const t_item * get_ptr() const
static void g_fill(t_int *p_order, const t_size p_count)
pfc::array_t< t_size > m_data
t_size find_reverse(t_size val)
Insecure - may deadlock or crash on invalid permutation content. In theory faster than walking the pe...
static bool g_is_identity(const t_array &p_array)
Bit array interface class, constant version (you can only retrieve values). Range of valid indexes d...
void swap(t_size ptr1, t_size ptr2)
void permutation_validate(t_size const *order, t_size count)
For critical sanity checks. Speed: O(n), allocates memory.
order_helper(t_size p_size)
t_size get_item(t_size ptr) const
t_size permutation_find_reverse(t_size const *order, t_size count, t_size value)
t_size operator[](t_size ptr) const
void set_size(t_size p_size)
t_size & operator[](t_size ptr)
bool permutation_is_valid(t_size const *order, t_size count)
For critical sanity checks. Speed: O(n), allocates memory.
void create_move_items_permutation(t_size *p_output, t_size p_count, const class bit_array &p_selection, int p_delta)
Creates a permutation that moves selected items in a list box by the specified delta-offset.
t_size array_size_t(const t_array &p_array)
const t_size * get_ptr() const
static bool g_is_identity(const t_size *order, t_size count)
order_helper(const order_helper &p_order)
void swap_t(T &p_item1, T &p_item2)
void reverse(t_size base, t_size count)
PFC_DECLARE_EXCEPTION(exception_map_entry_not_found, exception,"Map entry not found")
static void g_fill(t_array &p_array)