I don't want to use
an entire package, but I do want to import a few features, such as the "/="
operator. I know that renames
allows me to do this with most functions, but with the inequality operator I get the error, explicit definition of inequality not allowed
. How do I import this operator without raising the error?
package Integer_Maps is new Ada.Containers.Ordered_Maps
(
Key_Type => Integer,
Element_Type => Integer
);
-- the next line fails!
function "/=" ( Left, Right: Integer_Maps.Cursor ) return Boolean
renames Integer_Maps."/=";
You don't! not directly, at any rate. Renaming the equality operator "="
, and you get inequality for free.
-- this line succeeds!
function "=" ( Left, Right: Integer_Maps.Cursor ) return Boolean
renames Integer_Maps."=";
This is similar to overriding the operators. See ARM 6.6, in particular Static Semantics.