callme icon indicating copy to clipboard operation
callme copied to clipboard

Clarification: Is possible to have a Delegated unset ?

Open KammutierSpule opened this issue 6 months ago • 1 comments

I used other delegate libraries (eg: https://www.etlcpp.com/delegate.html) and is possible to have a Delegated unset, so I had to check is_valid before call the delegate.

Is this possible with this library? or this library forces that a Delegate is always valid and possible to call?

KammutierSpule avatar Jul 19 '25 21:07 KammutierSpule

Hello,

A default-constructed delegate is empty and it may be invoked, which has no effects. A non-default constructed delegate is bound to its target from the very beginning and cannot be reassigned any other target. An empty (default-constructed) delegate variable may be assigned a non-empty delegate. There are no such functions as is_valid() or empty(). Hope this helps

bitsbakery avatar Jul 20 '25 07:07 bitsbakery