On Tuesday, 7 July 2015 at 12:26:33 UTC, Per Nordlöw wrote:
I'm currently developing a high-level wrapper for FFMPEG at

https://github.com/nordlow/justd/blob/master/tests/t_ffmpeg.d

My question now becomes how to most easily wrap the iteration over streams at

https://github.com/nordlow/justd/blob/master/tests/t_ffmpeg.d#L150

https://github.com/nordlow/justd/blob/master/tests/t_ffmpeg.d#L152

in a nice D-style range interface.

Do I have to allocate a new D array and copy the `AVStream*` elements into that or is there a convenience wrapper for constructing a lazy range from a C style Array-pointer plus array-length?

Note that the elements of the C array are pointers to structs, in this case instances of `AVStream`. This, of course, complicates the matter with regard to GC-safety.

Comments on that please :)

I think a wrapper is quite easy to do, isn't it?
You just need to implement front popFront and empty and you're done.

So you avoid slice-related problems...

Reply via email to