C++ / Why Iterators Got It All Wrong
Ilya Yaroshenko via Digitalmars-d
digitalmars-d at puremagic.com
Sat Sep 2 19:08:20 PDT 2017
On Tuesday, 29 August 2017 at 12:50:08 UTC, Robert M. Münch wrote:
> Maybe of interest:
> https://www.think-cell.com/en/career/talks/iterators/#1
>
> I haven't read everything, so not sure if it worth to take a
> look.
Iterators has no proper alternative when one need to implement
generic tensor library like Mir Algorithm [1].
User level API is ndslice [4] (D n-dimensional random access
range) , can be combined with Phobos. In the same time library
uses low level unbounded random access iterator [2]
representation to implement 90% of topology logic. This approach
allows to maintain few times smaller, simpler and less
error-prone code comparing with std.range. The best example it
`bitwise` functions implementation in Phobos and Mir Algorithm.
Iterators are very good for type composition when one need its
own D range that can not be constructed using existing
mir.ndslice.topology / std.range API.
[1] https://github.com/libmir/mir-algorithm
[2]
http://docs.algorithm.dlang.io/latest/mir_ndslice_topology.html
[3]
http://docs.algorithm.dlang.io/latest/mir_ndslice_iterator.html
[4]
http://docs.algorithm.dlang.io/latest/mir_ndslice_slice.html#Slice
Best Regards,
Ilya
More information about the Digitalmars-d
mailing list