Index: src/natools-constant_indefinite_ordered_maps.adb ================================================================== --- src/natools-constant_indefinite_ordered_maps.adb +++ src/natools-constant_indefinite_ordered_maps.adb @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ --- Copyright (c) 2014-2015, Natacha Porté -- +-- Copyright (c) 2014-2017, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- @@ -332,10 +332,19 @@ Process.all (Accessor.Data.Nodes (Position.Index).Key.all, Accessor.Data.Nodes (Position.Index).Element.all); end Query_Element; + + function Rank (Position : Cursor) return Ada.Containers.Count_Type is + begin + case Position.Is_Empty is + when True => return 0; + when False => return Position.Index; + end case; + end Rank; + ----------------------------- -- Non-Standard Operations -- ----------------------------- Index: src/natools-constant_indefinite_ordered_maps.ads ================================================================== --- src/natools-constant_indefinite_ordered_maps.ads +++ src/natools-constant_indefinite_ordered_maps.ads @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ --- Copyright (c) 2014-2015, Natacha Porté -- +-- Copyright (c) 2014-2017, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- @@ -108,10 +108,14 @@ with Pre => Has_Element (Left) or else raise Constraint_Error; function "<" (Left : Key_Type; Right : Cursor) return Boolean with Pre => Has_Element (Right) or else raise Constraint_Error; function ">" (Left : Key_Type; Right : Cursor) return Boolean with Pre => Has_Element (Right) or else raise Constraint_Error; + + function Rank (Position : Cursor) return Ada.Containers.Count_Type; + -- Return 1-based numeric position of the element designated by Position + -- or zero when Position is empty. package Map_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element);