Delegates, Events and Callables

Typed Action, Func, Predicate and EventHandler behavior in native C++.

ConceptsSource 6d429559

Surface

Action, Func, Predicate and EventHandler-shaped types support familiar typed callback patterns and composition for the implemented subset.

Differences from managed delegates

  • No late-bound DynamicInvoke; calls are typed at compile time.
  • Capture ownership is ordinary C++.
  • Subscription does not make the target immortal.
  • Async callbacks can cross teardown and synchronization boundaries.

Safe practice

Document who owns each callable, how it is unsubscribed or cancelled, and whether invocation is serialized. Prefer weak ownership when a publisher can outlive a subscriber.