Collect only requires that the collection is iterable, for which providing an eltype() function is optional. I don't know if it is possible to check at runtime if eltype() exists for the collection then it could use that instead of Any, otherwise it would have to iterate the collection to find all the types and either accumulate the results in an Any collection as it goes and copy them to the right type collection later, or iterate twice.
On Saturday, November 28, 2015 at 10:17:09 AM UTC+10, Seth wrote: > > Well, I just found collect(Edge, edges(g)) works, but it would be nice if > collect() returned a vector of Edge by default. Any ideas? > > On Friday, November 27, 2015 at 3:46:58 PM UTC-8, Seth wrote: >> >> I have implemented my own iterator that works against edges in a graph, >> and edges(g) returns the iterator. However, collect(edges(g)) returns an >> array of Any,1. I'd like it to return an array of Edge, 1. What am I >> missing? >> >>