Dynamic array implmentation that works with range-for loop.