Const Tuples

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 25 06:09:55 PDT 2014


> I was just expressing a little frustration :-)

An example; despite it looks simple I am missing something:


import std.typecons: Tuple, tuple;
import std.algorithm: reduce;

struct Foo { int x; }

auto foo(in Tuple!(Foo[]) arg, int) {
     return tuple(arg[0]);
}

void main() {
     int[] data;
     Foo[] empty;
     auto seed = tuple(empty);
     reduce!foo(seed, data);
}


Bye,
bearophile


More information about the Digitalmars-d-learn mailing list