generic

    type Iterator is private;

    type Iterator_Element is private;

    with function Done (Iter : Iterator) return Boolean is <>;
    with function Value (Iter : Iterator) return Iterator_Element is <>;
    with procedure Next (Iter : in out Iterator) is <>;

package Generic_Iterator_Operations is

    generic
        with function Count (Elem : Iterator_Element) return Integer;
    procedure Total_Count (Iter : in out Iterator; Total : Integer);

    generic
        with function Predicate (Elem : Iterator_Element) return Boolean;
    procedure Check (Iter : in out Iterator; Found : out Boolean);

    generic
        with function Predicate (Elem : Iterator_Element) return Boolean;
    procedure Total_True (Iter : in out Iterator; Total : out Natural);

    generic
        type Information is private;

        with function Count (Info : Information; Elem : Iterator_Element)
                            return Integer;

    procedure Total_Count_With_Info (Info : Information;
                                     Iter : in out Iterator;
                                     Total : out Integer);

    generic
        type Information is private;

        with function Predicate (Info : Information; Elem : Iterator_Element)
                                return Boolean;
    procedure Total_True_With_Info
                 (Info : Information; Iter : in out Iterator; Total : Natural);

    generic
        type Information is private;

        with function Predicate (Info : Information; Elem : Iterator_Element)
                                return Boolean;
    procedure Check_With_Info (Info : Information;
                               Iter : in out Iterator;
                               Found : out Boolean);
    generic
        with procedure Apply (Elem : Iterator_Element);
    procedure Process_All (Iter : in out Iterator);

    generic
        type State is private;
        with function Initialize return State;
        with procedure Apply (Elem : Iterator_Element; S : in out State);
    procedure Process_All_With_State (Iter : in out Iterator);

end Generic_Iterator_Operations;
