Rationale for Ada 2005: 6a Containers

RUSTOP
BACKNEXT

ENG

6. Sorting

@ The final facilities in the container library are generic procedures for array sorting. There are two versions, one for unconstrained arrays and one for constrained arrays. Their specifications are

  1        generic
  2                type Index_Type is (<>);
  3                type Element_Type is private;
  4                type Array_Type is array (Index_Type range <>) of Element_Type;
  5                with function "<" (Left, Right : Element_Type) return Boolean is <>;
  6        procedure Ada.Containers.Generic_Array_Sort (Container : in out Array_Type);
  7                pragma Pure (Ada.Containers.Generic_Array_Sort);

@ and

  1        generic
  2                type Index_Type is (<>);
  3                type Element_Type is private;
  4                type Array_Type is array (Index_Type) of Element_Type;
  5                with function "<" (Left, Right : Element_Type) return Boolean is <>;
  6        procedure Ada.Containers.Generic_Constrained_Array_Sort (Container : in out Array_Type);
  7                pragma Pure (Ada.Containers.Generic_Constrained_Array_Sort);

@ These do the obvious thing. They sort the array Container into order as defined by the generic parameter "<". The emphasis is on speed.

Rationale for Ada 2005: 6a Containers

ENGRUSTOP
BACKNEXT

6. Сортировка

@ Последние средства в контейнерной библиотеке - универсальные процедуры для сортировки массивов. Имеется две версии, одна для неограниченных, другая - для ограниченных массивов. Их спецификации:

  1        generic
  2                type Index_Type is (<>);
  3                type Element_Type is private;
  4                type Array_Type is array (Index_Type range <>) of Element_Type;
  5                with function "<" (Left, Right : Element_Type) return Boolean is <>;
  6        procedure Ada.Containers.Generic_Array_Sort (Container : in out Array_Type);
  7                pragma Pure (Ada.Containers.Generic_Array_Sort);

@ и

  1        generic
  2                type Index_Type is (<>);
  3                type Element_Type is private;
  4                type Array_Type is array (Index_Type) of Element_Type;
  5                with function "<" (Left, Right : Element_Type) return Boolean is <>;
  6        procedure Ada.Containers.Generic_Constrained_Array_Sort (Container : in out Array_Type);
  7                pragma Pure (Ada.Containers.Generic_Constrained_Array_Sort);

@ Они делают очевидную вещь. Они сортируют массив Container в порядке определяемом универсальным параметром "<". Акцент делается на скорость выполнения.

ENG RUS

TOP BACK NEXT

2010-10-24 00:26:58

. .