On 10/07/2017 05:02 PM, Steven Schveighoffer wrote:
>
https://github.com/schveiguy/dcollections/blob/master/dcollections/Deque.d
>
> It's implemented by maintaining 2 dynamic arrays, one that is "reversed"
> at the front, and one that is normal at the back. When you prepend, it
> appends to the "reverse" array.
>
> It's probably not the most efficient, but it does maintain the correct
> complexities.
I stole the idea from one of Chuck Allison's DConf talks[1] and used as
the example for the Indexing Operators section here:
http://ddili.org/ders/d.en/operator_overloading.html#ix_operator_overloading.opIndex
> Note: that code is many years old, so it may not compile with the latest
> compiler.
Mine is supposed to compile with 2.076.
> -Steve
Ali
[1] He knows about the theft. :)