Reputation: 21
I wonder what is the syntax to pass a package to a generic function. I've tried several ways without success.
for ex.:
generic
with package <<SomeThing>> is <>;
procedure forEach(g: in <<MyType>>);
OR
generic
with package <<SomeThing>>;
procedure forEach(g: in <<MyType>>);
OR
generic
package <<SomeThing>>;
procedure forEach(g: in <<MyType>>);
Upvotes: 1
Views: 707
Reputation: 2715
The package must be an instance of a generic package (otherwise the compiler would not know anything about the package). The syntax is:
generic
with package Foo is new Bar (<>);
procedure Foreach (G : Foo.T);
See the Ada Wikibook and the examples at the end of the Reference Manual section on formal packages (ARM 12.7).
Upvotes: 5