Templates: Array slices not recognized
Chris via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Apr 20 02:07:51 PDT 2015
On Saturday, 18 April 2015 at 17:59:19 UTC, ketmar wrote:
> On Sat, 18 Apr 2015 17:50:56 +0000, Chris wrote:
>
>> Doh! You're right! My bad. However, this makes the function
>> less
>> generic, but it doesn't matter here.
>
> maybe `auto ref` can help here?
Yes, auto ref does the trick. I prefer it to passing the slice by
value, because I can extend the function to cater for more types.
My implementation (which is different from the one posted above)
works also with strings, for example. Anyway, it gave me a
performance boost of ~2.7 times as compared to the workarounds I
had. This was well worth it!
More information about the Digitalmars-d-learn
mailing list