Generate range

John Chapman johnch_atms at hotmail.com
Mon Oct 22 22:51:02 UTC 2018


Given a function that returns a count of items, and another 
function that returns an item at an index, is there anything 
built into Phobos that can use them together to build a range?

The two functions are from an external API, eg:

   int getFontCount();
   Item getItemAt(int index);

I was wondering if there was something like a "rangeOf" as 
illustrated:

   foreach (item; rangeOf!(() => getFontCount(), (i) => 
getItemAt(i)) {
   }


More information about the Digitalmars-d-learn mailing list