Using a delegate as an argument to a function (for callbacks)

4.27+

I’m trying to implement an anonymous callback system.

I’m currently using something like

static void NameSpace::SomeFunc(TFunction<void(bool)> CallBack)
{
     bool bSomeCondition
     //Do Something
     if(CallBack) CallBack(bSomeCondition);
}

I’d rather not use TFunction directly if I can as I’m unsure how safe it will be, or how to make it more safe.

I’d rather have the function take in some kind of delegate, preferably a dynamic multicast delegate, but I cannot seem to get the syntax correct. It also just might not be possible, but I cant really figure how to determine that either. Thanks community!