Templates and delegates trouble
public at kyllingen.NOSPAMnet
Wed Oct 8 11:17:35 PDT 2008
Steven Schveighoffer wrote:
> "Lars Kyllingstad" wrote
>> I want to make a function (named 'call' in the example below) that calls
>> another function (F). I want to allow F to be an ordinary function, a
>> delegate, or a functor. I've been able to make it work with functions and
>> functors, but not with delegates. Any tips would be greatly appreciated.
> You can't alias a delegate like that.
> Try this:
> auto sqrt = new Sqrt;
> auto fn = &sqrt.eval;
This works. Thank you!
> What is happening is you are aliasing the eval function symbol, but not the
> sqrt instance to call it from. Aliasing isn't exactly like a macro
> This might also work (haven't tested it):
This doesn't work.
More information about the Digitalmars-d-learn