with Ada.Iterator_Interfaces, Ada.Finalization, ASN1_Iterators.Iterable_Type; use Ada.Finalization; generic type ASN1_Type is private; with package ASN1_Iterable is new ASN1_Iterators.Iterable_Type (ASN1_Type); type Actual_Iterable is new ASN1_Iterable.Iterable with private; package ASN1_Iterators.Generic_Iterator is type Generic_Iterator_Type is tagged --new Controlled with record Item: Actual_Iterable; end record with Default_Iterator => Iterate, Iterator_Element => ASN1_Type, Constant_Indexing => Elem; type Cursor is access all Generic_Iterator_Type; function Elem (Self : Generic_Iterator_Type; Position : Cursor) return ASN1_Type is (Position.Item.Element); function Has_Element (Position : Cursor) return Boolean is (ASN1_Iterable.Has_Element(ASN1_Iterable.Iterable'Class(Position.all.Item))); package Iterators is new Ada.Iterator_Interfaces (Cursor, Has_Element); type Iterator is new Iterators.Forward_Iterator with record Position : Cursor; end record; --overriding --procedure Initialize (Self: in out Generic_Iterator_Type); overriding function First (Item : Iterator) return Cursor; overriding function Next (Item : Iterator; Position : Cursor) return Cursor; function Iterate (self : Generic_Iterator_Type) return Iterators.Forward_Iterator'Class; end;