History of Idiom 28 > diff from v26 to v27
Edit summary for version 27 :
New Ada implementation by user [Smaehtin]
New Ada implementation by user [Smaehtin]
↷
Version 26
2016-02-17, 11:15:03
Version 27
2016-02-17, 16:25:43
Idiom #28 Sort by a property
Sort elements of array-like collection items in ascending order of x.p, where p is a field of type Item of the objects in items.
Idiom #28 Sort by a property
Sort elements of array-like collection items in ascending order of x.p, where p is a field of type Item of the objects in items.
Imports
with Ada.Containers.Vectors; use Ada.Containers;
Code
declare function Compare_Function (Left, Right : Item) return Boolean is (Left.P < Right.P); package Item_Vector_Sorting is new Item_Vectors.Generic_Sorting (Compare_Function); use Item_Vector_Sorting; begin Sort (Items); end;