Implicit cast to const of result returned from findSplit()

Stanislav Blinov stanislav.blinov at gmail.com
Mon Nov 5 13:33:58 UTC 2018


On Monday, 5 November 2018 at 13:26:18 UTC, Per Nordlöw wrote:

> AFAICT, it looks like a missing bool qualifier on 
> `opCast!bool`, right?

...Like a missing 'const' qualifier ;)

auto findSplit(alias pred = "a == b", R1, R2)(R1 haystack, R2 
needle)
// ...
     static struct Result(S1, S2) if (isForwardRange!S1 &&
                                      isForwardRange!S2)
     {
// ...
         bool opCast(T : bool)()
         {
             return !asTuple[1].empty;
         }
// ...
     }



More information about the Digitalmars-d-learn mailing list