I have the following records:
type Items is
record
Feature_A : Type_Feature_A;
Feature_B : Type_Feature_B;
Feature_C : Type_Feature_C;
Feature_D : Type_Feature_D;
end record;
type My_Array is array (1 .. 10) of Items;
type My_Record is
record
Count : Integer;
Item_Arr : My_Array;
end record;
I worked with the type My_Record, for example I stored 8 items in the array and then I want to extract items 2 by 2.
To do that I have declared a function that copy the 2 first items of the array to a subtype of My_Array and decrement 'Count' by 2. Then I slice 'Item_Arr':
Item_Arr(1..8) := Item_Arr(3..10);
Item_Arr(9..10) := Default_Value;
My question is: Is it the proper way to do that? Or it will be better to loop over items and each times I found an item different from the 'Default_Value' I added it to the output array and so on.
In terms of performance, comparing records is faster than slicing an array?
Thank you