Struggling to implement parallel foreach...

Exil Exil at gmall.com
Fri Jun 14 20:52:04 UTC 2019


Looks like it was an overlooked detail? There are a few messy 
implementation details with function/delegate. If you take the 
address of a member function, without a variable. You get a 
function, from the looks of it that function can be const, which 
doesn't make sense. But then the fact it is a function and not a 
delegate also doesn't make sense.

struct S {
    void foo() const {}
}

pragma(msg, typeof(&S.foo)); // void function() const

Anyways even if you do shared like you would in a struct. You 
can't implicitly convert to shared in the way you can const.

struct D {
     int a;
     void foo() shared {
         pragma(msg, typeof(a)); // int
     }

     void bar() const {
         pragma(msg, typeof(a)); // const int
     }
}

So it is a bug for const at the very least, but shared is ya...



More information about the Digitalmars-d mailing list