procedure Append
(Container : in out List;
New_Item : Element_Type;
- Count : Count_Type := 1)
+ Count : Count_Type)
is
begin
Insert (Container, No_Element, New_Item, Count);
end Append;
- ---------------
- -- Append_One --
- ---------------
-
- procedure Append_One
+ procedure Append
(Container : in out List;
New_Item : Element_Type)
is
begin
Insert (Container, No_Element, New_Item, 1);
- end Append_One;
+ end Append;
------------
-- Assign --
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
Aggregate => (Empty => Empty,
- Add_Unnamed => Append_One);
+ Add_Unnamed => Append);
pragma Preelaborable_Initialization (List);
type Cursor is private;
procedure Append
(Container : in out List;
New_Item : Element_Type;
- Count : Count_Type := 1);
+ Count : Count_Type);
- procedure Append_One
+ procedure Append
(Container : in out List;
New_Item : Element_Type);
procedure Append
(Container : in out List;
New_Item : Element_Type;
- Count : Count_Type := 1)
+ Count : Count_Type)
is
begin
Insert (Container, No_Element, New_Item, Count);
end Append;
- ---------------
- -- Append_One --
- ---------------
-
- procedure Append_One
+ procedure Append
(Container : in out List;
New_Item : Element_Type)
is
begin
Insert (Container, No_Element, New_Item, 1);
- end Append_One;
+ end Append;
------------
-- Assign --
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
Aggregate => (Empty => Empty,
- Add_Unnamed => Append_One);
+ Add_Unnamed => Append);
pragma Preelaborable_Initialization (List);
procedure Append
(Container : in out List;
New_Item : Element_Type;
- Count : Count_Type := 1);
+ Count : Count_Type);
- procedure Append_One
+ procedure Append
(Container : in out List;
New_Item : Element_Type);
procedure Append
(Container : in out List;
New_Item : Element_Type;
- Count : Count_Type := 1)
+ Count : Count_Type)
is
begin
Insert (Container, No_Element, New_Item, Count);
end Append;
- ---------------
- -- Append_One --
- ---------------
-
- procedure Append_One
+ procedure Append
(Container : in out List;
New_Item : Element_Type)
is
begin
Insert (Container, No_Element, New_Item, 1);
- end Append_One;
+ end Append;
------------
-- Assign --
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
Aggregate => (Empty => Empty,
- Add_Unnamed => Append_One);
+ Add_Unnamed => Append);
pragma Preelaborable_Initialization (List);
procedure Append
(Container : in out List;
New_Item : Element_Type;
- Count : Count_Type := 1);
+ Count : Count_Type);
- procedure Append_One
+ procedure Append
(Container : in out List;
New_Item : Element_Type);
-- Append --
------------
- procedure Append (Container : in out Vector; New_Item : Vector) is
+ procedure Append
+ (Container : in out Vector;
+ New_Item : Element_Type;
+ Count : Count_Type)
+ is
begin
- if New_Item.Is_Empty then
+ if Count = 0 then
return;
end if;
raise Constraint_Error with "vector is already at its maximum length";
end if;
- Container.Insert (Container.Last + 1, New_Item);
+ Container.Insert (Container.Last + 1, New_Item, Count);
end Append;
- procedure Append
- (Container : in out Vector;
- New_Item : Element_Type;
- Count : Count_Type := 1)
- is
+ -------------------
+ -- Append_Vector --
+ -------------------
+
+ procedure Append_Vector (Container : in out Vector; New_Item : Vector) is
begin
- if Count = 0 then
+ if New_Item.Is_Empty then
return;
end if;
raise Constraint_Error with "vector is already at its maximum length";
end if;
- Container.Insert (Container.Last + 1, New_Item, Count);
- end Append;
+ Container.Insert_Vector (Container.Last + 1, New_Item);
+ end Append_Vector;
- ----------------
- -- Append_One --
- ----------------
+ ------------
+ -- Append --
+ ------------
- procedure Append_One (Container : in out Vector;
- New_Item : Element_Type)
+ procedure Append (Container : in out Vector;
+ New_Item : Element_Type)
is
begin
Insert (Container, Last_Index (Container) + 1, New_Item, 1);
- end Append_One;
+ end Append;
--------------
-- Capacity --
end if;
end Insert;
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Extended_Index;
New_Item : Vector)
Container.Elements (B + N - Src'Length .. B + N - 1) := Src;
end;
- end Insert;
+ end Insert_Vector;
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector)
Index := Before.Index;
end if;
- Insert (Container, Index, New_Item);
- end Insert;
+ Insert_Vector (Container, Index, New_Item);
+ end Insert_Vector;
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector;
Index := Before.Index;
end if;
- Insert (Container, Index, New_Item);
+ Insert_Vector (Container, Index, New_Item);
Position := Cursor'(Container'Unchecked_Access, Index);
- end Insert;
+ end Insert_Vector;
procedure Insert
(Container : in out Vector;
-- Prepend --
-------------
- procedure Prepend (Container : in out Vector; New_Item : Vector) is
- begin
- Insert (Container, Index_Type'First, New_Item);
- end Prepend;
-
procedure Prepend
(Container : in out Vector;
New_Item : Element_Type;
Count : Count_Type := 1)
is
begin
- Insert (Container,
- Index_Type'First,
- New_Item,
- Count);
+ Insert (Container, Index_Type'First, New_Item, Count);
end Prepend;
+ --------------------
+ -- Prepend_Vector --
+ --------------------
+
+ procedure Prepend_Vector (Container : in out Vector; New_Item : Vector) is
+ begin
+ Insert_Vector (Container, Index_Type'First, New_Item);
+ end Prepend_Vector;
+
--------------
-- Previous --
--------------
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
Aggregate => (Empty => Empty,
- Add_Unnamed => Append_One,
+ Add_Unnamed => Append,
New_Indexed => New_Vector,
Assign_Indexed => Replace_Element);
procedure Move (Target : in out Vector; Source : in out Vector);
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Extended_Index;
New_Item : Vector);
procedure Insert
+ (Container : in out Vector;
+ Before : Extended_Index;
+ New_Item : Vector) renames Insert_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector);
procedure Insert
+ (Container : in out Vector;
+ Before : Cursor;
+ New_Item : Vector) renames Insert_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector;
Position : out Cursor);
+ procedure Insert
+ (Container : in out Vector;
+ Before : Cursor;
+ New_Item : Vector;
+ Position : out Cursor) renames Insert_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
procedure Insert
(Container : in out Vector;
Before : Extended_Index;
Position : out Cursor;
Count : Count_Type := 1);
- procedure Prepend
+ procedure Prepend_Vector
(Container : in out Vector;
New_Item : Vector);
+ procedure Prepend
+ (Container : in out Vector;
+ New_Item : Vector) renames Prepend_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
procedure Prepend
(Container : in out Vector;
New_Item : Element_Type;
Count : Count_Type := 1);
- procedure Append
+ procedure Append_Vector
(Container : in out Vector;
New_Item : Vector);
+ procedure Append
+ (Container : in out Vector;
+ New_Item : Vector) renames Append_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
procedure Append
(Container : in out Vector;
New_Item : Element_Type;
- Count : Count_Type := 1);
+ Count : Count_Type);
- procedure Append_One (Container : in out Vector;
- New_Item : Element_Type);
- -- Ada_2020 aggregate operation.
+ procedure Append (Container : in out Vector;
+ New_Item : Element_Type);
procedure Insert_Space
(Container : in out Vector;
begin
return Result : Vector do
Reserve_Capacity (Result, Length (Left) + Length (Right));
- Append (Result, Left);
- Append (Result, Right);
+ Append_Vector (Result, Left);
+ Append_Vector (Result, Right);
end return;
end "&";
begin
return Result : Vector do
Reserve_Capacity (Result, Length (Left) + 1);
- Append (Result, Left);
+ Append_Vector (Result, Left);
Append (Result, Right);
end return;
end "&";
return Result : Vector do
Reserve_Capacity (Result, 1 + Length (Right));
Append (Result, Left);
- Append (Result, Right);
+ Append_Vector (Result, Right);
end return;
end "&";
end;
end Adjust;
- ------------
- -- Append --
- ------------
+ -------------------
+ -- Append_Vector --
+ -------------------
- procedure Append (Container : in out Vector; New_Item : Vector) is
+ procedure Append_Vector (Container : in out Vector; New_Item : Vector) is
begin
if Is_Empty (New_Item) then
return;
elsif Checks and then Container.Last = Index_Type'Last then
raise Constraint_Error with "vector is already at its maximum length";
else
- Insert (Container, Container.Last + 1, New_Item);
+ Insert_Vector (Container, Container.Last + 1, New_Item);
end if;
- end Append;
+ end Append_Vector;
procedure Append
(Container : in out Vector;
New_Item : Element_Type;
- Count : Count_Type := 1)
+ Count : Count_Type)
is
begin
-- In the general case, we pass the buck to Insert, but for efficiency,
end if;
end Append;
- ----------------
- -- Append_One --
- ----------------
+ ------------
+ -- Append --
+ ------------
- procedure Append_One (Container : in out Vector;
+ procedure Append (Container : in out Vector;
New_Item : Element_Type)
is
begin
Insert (Container, Last_Index (Container) + 1, New_Item, 1);
- end Append_One;
+ end Append;
----------------------
-- Append_Slow_Path --
return;
else
Target.Clear;
- Target.Append (Source);
+ Target.Append_Vector (Source);
end if;
end Assign;
end;
end Insert;
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Extended_Index;
New_Item : Vector)
Dst_Index := Dst_Index + 1;
end loop;
end;
- end Insert;
+ end Insert_Vector;
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector)
Index := Before.Index;
end if;
- Insert (Container, Index, New_Item);
- end Insert;
+ Insert_Vector (Container, Index, New_Item);
+ end Insert_Vector;
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector;
Index := Before.Index;
end if;
- Insert (Container, Index, New_Item);
+ Insert_Vector (Container, Index, New_Item);
Position := (Container'Unrestricted_Access, Index);
- end Insert;
+ end Insert_Vector;
procedure Insert
(Container : in out Vector;
-- Prepend --
-------------
- procedure Prepend (Container : in out Vector; New_Item : Vector) is
- begin
- Insert (Container, Index_Type'First, New_Item);
- end Prepend;
-
procedure Prepend
(Container : in out Vector;
New_Item : Element_Type;
Insert (Container, Index_Type'First, New_Item, Count);
end Prepend;
+ -------------
+ -- Prepend_Vector --
+ -------------
+
+ procedure Prepend_Vector (Container : in out Vector; New_Item : Vector) is
+ begin
+ Insert_Vector (Container, Index_Type'First, New_Item);
+ end Prepend_Vector;
+
--------------
-- Previous --
--------------
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
Aggregate => (Empty => Empty_Vector,
- Add_Unnamed => Append_One,
+ Add_Unnamed => Append,
New_Indexed => New_Vector,
Assign_Indexed => Replace_Element);
procedure Move (Target : in out Vector; Source : in out Vector);
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Extended_Index;
New_Item : Vector);
procedure Insert
+ (Container : in out Vector;
+ Before : Extended_Index;
+ New_Item : Vector) renames Insert_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector);
procedure Insert
+ (Container : in out Vector;
+ Before : Cursor;
+ New_Item : Vector) renames Insert_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector;
Position : out Cursor);
+ procedure Insert
+ (Container : in out Vector;
+ Before : Cursor;
+ New_Item : Vector;
+ Position : out Cursor) renames Insert_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
procedure Insert
(Container : in out Vector;
Before : Extended_Index;
Position : out Cursor;
Count : Count_Type := 1);
- procedure Prepend
+ procedure Prepend_Vector
(Container : in out Vector;
New_Item : Vector);
+ procedure Prepend
+ (Container : in out Vector;
+ New_Item : Vector) renames Prepend_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
procedure Prepend
(Container : in out Vector;
New_Item : Element_Type;
Count : Count_Type := 1);
- procedure Append
+ procedure Append_Vector
(Container : in out Vector;
New_Item : Vector);
+ procedure Append
+ (Container : in out Vector;
+ New_Item : Vector) renames Append_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
procedure Append
(Container : in out Vector;
New_Item : Element_Type;
- Count : Count_Type := 1);
+ Count : Count_Type);
- procedure Append_One (Container : in out Vector;
- New_Item : Element_Type);
+ procedure Append (Container : in out Vector;
+ New_Item : Element_Type);
procedure Insert_Space
(Container : in out Vector;
begin
return Result : Vector do
Reserve_Capacity (Result, Length (Left) + Length (Right));
- Append (Result, Left);
- Append (Result, Right);
+ Append_Vector (Result, Left);
+ Append_Vector (Result, Right);
end return;
end "&";
begin
return Result : Vector do
Reserve_Capacity (Result, Length (Left) + 1);
- Append (Result, Left);
+ Append_Vector (Result, Left);
Append (Result, Right);
end return;
end "&";
return Result : Vector do
Reserve_Capacity (Result, 1 + Length (Right));
Append (Result, Left);
- Append (Result, Right);
+ Append_Vector (Result, Right);
end return;
end "&";
-- Append --
------------
- procedure Append (Container : in out Vector; New_Item : Vector) is
- begin
- if Is_Empty (New_Item) then
- return;
- elsif Checks and then Container.Last = Index_Type'Last then
- raise Constraint_Error with "vector is already at its maximum length";
- else
- Insert (Container, Container.Last + 1, New_Item);
- end if;
- end Append;
-
procedure Append
(Container : in out Vector;
New_Item : Element_Type;
- Count : Count_Type := 1)
+ Count : Count_Type)
is
begin
-- In the general case, we pass the buck to Insert, but for efficiency,
end if;
end Append;
- ----------------
- -- Append_One --
- ----------------
+ -------------------
+ -- Append_Vector --
+ -------------------
+
+ procedure Append_Vector (Container : in out Vector; New_Item : Vector) is
+ begin
+ if Is_Empty (New_Item) then
+ return;
+ elsif Checks and then Container.Last = Index_Type'Last then
+ raise Constraint_Error with "vector is already at its maximum length";
+ else
+ Insert_Vector (Container, Container.Last + 1, New_Item);
+ end if;
+ end Append_Vector;
+
+ ------------
+ -- Append --
+ ------------
- procedure Append_One (Container : in out Vector;
- New_Item : Element_Type)
+ procedure Append (Container : in out Vector;
+ New_Item : Element_Type)
is
begin
Insert (Container, Last_Index (Container) + 1, New_Item, 1);
- end Append_One;
+ end Append;
----------------------
-- Append_Slow_Path --
return;
else
Target.Clear;
- Target.Append (Source);
+ Target.Append_Vector (Source);
end if;
end Assign;
end;
end Insert;
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Extended_Index;
New_Item : Vector)
Container.Elements.EA (K .. J) := Src;
end;
- end Insert;
+ end Insert_Vector;
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector)
Index := Before.Index;
end if;
- Insert (Container, Index, New_Item);
- end Insert;
+ Insert_Vector (Container, Index, New_Item);
+ end Insert_Vector;
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector;
Index := Before.Index;
end if;
- Insert (Container, Index, New_Item);
+ Insert_Vector (Container, Index, New_Item);
Position := (Container'Unrestricted_Access, Index);
- end Insert;
+ end Insert_Vector;
procedure Insert
(Container : in out Vector;
-- Prepend --
-------------
- procedure Prepend (Container : in out Vector; New_Item : Vector) is
- begin
- Insert (Container, Index_Type'First, New_Item);
- end Prepend;
-
procedure Prepend
(Container : in out Vector;
New_Item : Element_Type;
Insert (Container, Index_Type'First, New_Item, Count);
end Prepend;
+ --------------------
+ -- Prepend_Vector --
+ --------------------
+
+ procedure Prepend_Vector (Container : in out Vector; New_Item : Vector) is
+ begin
+ Insert_Vector (Container, Index_Type'First, New_Item);
+ end Prepend_Vector;
+
--------------
-- Previous --
--------------
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
Aggregate => (Empty => Empty,
- Add_Unnamed => Append_One,
+ Add_Unnamed => Append,
New_Indexed => New_Vector,
Assign_Indexed => Replace_Element);
with Pre => First = Index_Type'First;
-- Ada_2020 aggregate operation.
- procedure Insert
+ procedure Insert_Vector
(Container : in out Vector;
Before : Extended_Index;
New_Item : Vector);
-- If Before is not in the range First_Index (Container) .. Last_Index
-- (Container) + 1, then Constraint_Error is propagated. If
- -- Length(New_Item) is 0, then Insert does nothing. Otherwise, it computes
- -- the new length NL as the sum of the current length and Length
+ -- Length(New_Item) is 0, then Insert_Vector does nothing. Otherwise, it
+ -- computes the new length NL as the sum of the current length and Length
-- (New_Item); if the value of Last appropriate for length NL would be
-- greater than Index_Type'Last then Constraint_Error is propagated.
--
-- If the current vector capacity is less than NL, Reserve_Capacity
- -- (Container, NL) is called to increase the vector capacity. Then Insert
- -- slides the elements in the range Before .. Last_Index (Container) up by
- -- Length(New_Item) positions, and then copies the elements of New_Item to
- -- the positions starting at Before. Any exception raised during the
- -- copying is propagated.
+ -- (Container, NL) is called to increase the vector capacity. Then
+ -- Insert_Vector slides the elements in the range Before .. Last_Index
+ -- (Container) up by Length(New_Item) positions, and then copies the
+ -- elements of New_Item to the positions starting at Before. Any exception
+ -- raised during the copying is propagated.
procedure Insert
+ (Container : in out Vector;
+ Before : Extended_Index;
+ New_Item : Vector) renames Insert_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector);
-- If Before is not No_Element, and does not designate an element in
-- Container, then Program_Error is propagated. Otherwise, if
- -- Length(New_Item) is 0, then Insert does nothing. If Before is
- -- No_Element, then the call is equivalent to Insert (Container, Last_Index
- -- (Container) + 1, New_Item); otherwise the call is equivalent to Insert
- -- (Container, To_Index (Before), New_Item);
+ -- Length(New_Item) is 0, then Insert_Vector does nothing. If Before is
+ -- No_Element, then the call is equivalent to Insert_Vector (Container,
+ -- Last_Index (Container) + 1, New_Item); otherwise the call is equivalent
+ -- to Insert_Vector (Container, To_Index (Before), New_Item);
procedure Insert
+ (Container : in out Vector;
+ Before : Cursor;
+ New_Item : Vector) renames Insert_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
+ procedure Insert_Vector
(Container : in out Vector;
Before : Cursor;
New_Item : Vector;
-- If Before is not No_Element, and does not designate an element in
-- Container, then Program_Error is propagated. If Before equals
-- No_Element, then let T be Last_Index (Container) + 1; otherwise, let T
- -- be To_Index (Before). Insert (Container, T, New_Item) is called, and
- -- then Position is set to To_Cursor (Container, T).
+ -- be To_Index (Before). Insert_Vector (Container, T, New_Item) is called,
+ -- and then Position is set to To_Cursor (Container, T).
+
+ procedure Insert
+ (Container : in out Vector;
+ Before : Cursor;
+ New_Item : Vector;
+ Position : out Cursor) renames Insert_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
procedure Insert
(Container : in out Vector;
Before : Extended_Index;
New_Item : Element_Type;
Count : Count_Type := 1);
- -- Equivalent to Insert (Container, Before, To_Vector (New_Item, Count));
+ -- Equivalent to:
+ -- Insert_Vector (Container, Before, To_Vector (New_Item, Count));
procedure Insert
(Container : in out Vector;
Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1);
- -- Equivalent to Insert (Container, Before, To_Vector (New_Item, Count));
+ -- Equivalent to:
+ -- Insert_Vector (Container, Before, To_Vector (New_Item, Count));
procedure Insert
(Container : in out Vector;
Position : out Cursor;
Count : Count_Type := 1);
-- Equivalent to
- -- Insert (Container, Before, To_Vector (New_Item, Count), Position);
+ -- Insert_Vector (Container, Before, To_Vector (New_Item, Count), Position)
procedure Insert
(Container : in out Vector;
-- be To_Index (Before). Insert (Container, T, Count) is called, and then
-- Position is set to To_Cursor (Container, T).
- procedure Prepend
+ procedure Prepend_Vector
(Container : in out Vector;
New_Item : Vector);
-- Equivalent to Insert (Container, First_Index (Container), New_Item).
+ procedure Prepend
+ (Container : in out Vector;
+ New_Item : Vector) renames Prepend_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
procedure Prepend
(Container : in out Vector;
New_Item : Element_Type;
-- Equivalent to Insert (Container, First_Index (Container), New_Item,
-- Count).
- procedure Append
+ procedure Append_Vector
(Container : in out Vector;
New_Item : Vector);
-- Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item).
+ procedure Append
+ (Container : in out Vector;
+ New_Item : Vector) renames Append_Vector;
+ -- Retained for now for compatibility; AI12-0400 will remove this.
+
procedure Append
(Container : in out Vector;
New_Item : Element_Type;
- Count : Count_Type := 1);
+ Count : Count_Type);
-- Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item,
-- Count).
- procedure Append_One (Container : in out Vector;
- New_Item : Element_Type);
- -- Ada_2020 aggregate operation.
+ procedure Append (Container : in out Vector;
+ New_Item : Element_Type);
procedure Insert_Space
(Container : in out Vector;