Circular Buffer
Frustrated
c1514843 at drdrb.com
Thu Feb 13 12:56:32 PST 2014
On Monday, 10 February 2014 at 10:41:06 UTC, Russel Winder wrote:
> On Mon, 2014-02-10 at 09:16 +0000, Gary Willoughby wrote:
>> On Monday, 10 February 2014 at 03:14:31 UTC, Jonathan Dunlap
>> wrote:
>> > (disclaimer: I'm new around here)
>> > Is it possible to cycle backwards? If not, what's the best
>> > approach?
>>
>> import std.algorithm;
>> import std.array;
>> import std.range;
>> import std.stdio;
>>
>> void main(string[] args)
>> {
>> auto data = [1,2,3];
>>
>> assert(data.cycle.take(5).array == [1,2,3,1,2]);
>> assert(data.retro.cycle.take(5).array == [3,2,1,3,2]);
>> }
>
> This is why people should be using D instead of C++! This
> really needs
> to get onto the D website somewhere.
how efficient is ufcs? It seems like it would be very slow in
general and way better to manually do the code. I wonder if
anyone has done any tests?
More information about the Digitalmars-d-learn
mailing list