As I understand from here anything that implements Ada.Iterator_Interfaces can use the Ada 2012 for loop syntax. "for ... [in|of] .. loop .. end loop;
How do I create a generic subprogram that I can instantiate with a type in a package that implements the Ada.Iterator_Interfaces? and so then be able to have that subprogram iterate over that type using an Ada 2012 for loop.
In Java this might look like:
public String join(Iterable<String> collection) {
for (item : collection){
//do stuff
}
}
For example (although not the only case) a classic join function that can take any iterable container containing strings and return all the strings joined together in a string list. eg.
my_container = ["a","b","c"]
join(my_container) = "abc"
Thanks
Matt