FlexibleDelegate.opAssign

These opAssign overloads are what puts the flexibility in the flexible delegate.

  1. void opAssign(DelegateType dg)
  2. void opAssign(ReturnType delegate() dg)
    struct FlexibleDelegate(DelegateType)
    static if(is(DelegateType FunctionType == delegate))
    static if(is(FunctionType Parameters == __parameters))
    static if(is(DelegateType ReturnType == return))
    void
    opAssign
    (
    ReturnType delegate
    ()
    dg
    )
  3. void opAssign(ReturnType function(Parameters params) dg)
  4. void opAssign(ReturnType function() dg)
  5. void opAssign(typeof(null) explicitNull)

Bugs

The other overloads do not keep attributes like nothrow on the dg parameter, making them unusable if DelegateType requires them. I consider the attributes more trouble than they're worth anyway, and the language's poor support for composing them doesn't help any. I have no need for them and thus no plans to add them in the overloads at this time.

Meta