popAllAndDispatch#

Fully qualified name: carb::eventdispatcher::popAllAndDispatch

Defined in carb/eventdispatcher/EventDispatcherUtils.h

inline IMessageQueue::ExpectedType carb::eventdispatcher::popAllAndDispatch(
IMessageQueue *p,
) noexcept#

Pops all entries from a message queue and dispatches them.

Effectively:

auto ed = carb::getCachedInterface<IEventDispatcher>();
IMessageQueue::ExpectedType exp;
while ((exp = p->pop([&](const Event& e) { ed->internalDispatch(e); })).has_value())
    ;
return exp;

Parameters:

p – The IMessageQueue to pop in a loop.

Returns:

An expected value that is the first unexpected result from IMessageQueue::pop.