I am working on translating Stepanov’s “Elements of Programming” to Rust. I have started with Chapter 6 “Iterators” because I believe that if I can successfully translate this section which involves the most complex type relationships, the rest of the code in the book should be straightforward. These iterators are not ‘safe’ in the way Rust’s standard ones are, as they have no range checks, but they represent the most Generic concept of an iterator, and provide many access patterns. The code is here: https://github.com/keean/elements_in_rust

Rust’s traits provide quite a good match for the C++ “concepts” used in the book, the only real issue so far is that I have not been able to define the Readable trait as intended, due to restrictions on trait specialisation. This leads to the algorithms being less general than their C++ equivalents because they cannot operate on both values and references.