Generic method that takes in either delegate or function

Stanislav Blinov stanislav.blinov at
Wed Jan 12 00:43:07 PST 2011

On 01/12/2011 11:21 AM, %u wrote:
> Hi,
> Is there any way to specify a parameter as "something that can be called with
> parameter types A, B, C and that returns a value of type D", without caring
> whether it's a delegate, a function, or an object that overloads opCall? (This
> might require the use of templates, but I still can't figure it out...)
> Thank you!

See in std.traits:


You can use those in template constraints/static assert conditions.

More information about the Digitalmars-d-learn mailing list