std.algorithm issue

Dee Girl deegirl at noreply.com
Thu May 22 14:12:27 PDT 2008


Brian Myers Wrote:

> Hmmm, for some reason this is still not working. It must be because the reduce statement is itself within a method of the same class as Merge. Here's what I've got.

This code does not work:

#!/home/yasuko/bin/rdmd -O -release
import std.algorithm;

class Sorter {}

class ExternalSorter : Sorter {
    string Merge(string f1, string f2) {
        return f1 ~ f2;
    }

    void Sort() {
        string[] chunk_list = [ "a", "b" ];
        auto mrg = &Merge;
        auto retfile = reduce!(mrg)(chunk_list[0], chunk_list[1..$]);
    }
}

void main(string[] args)
{
    auto s = new ExternalSorter;
    s.Sort;
}

But I know how to make it work because I look at the error message. You go to std.algorithm and make NxNHelper from private to public. Then inside NxNHelper also make For from private to public. Then code works.

Maybe bug report to Walter is necessary. Private should work because lookup is in correct module. It is bug in compiler not library. Can you please? Thank you, Dee Girl




More information about the Digitalmars-d mailing list