Tidying lambdas
This commit is contained in:
@@ -29,7 +29,7 @@ void EventListener::waitAndDispatch(int msTimeout) {
|
||||
auto registeredEventTypes = this->getRegisteredEventTypes();
|
||||
std::optional<SharedGenericEventPointer> event;
|
||||
|
||||
auto eventsFound = [®isteredEventTypes, &event, &eventQueueByType]() -> bool {
|
||||
auto eventsFound = [®isteredEventTypes, &event, &eventQueueByType] () -> bool {
|
||||
for (auto& eventQueue: eventQueueByType) {
|
||||
if (registeredEventTypes.contains(eventQueue.first) && !eventQueue.second.empty()) {
|
||||
return true;
|
||||
@@ -86,7 +86,7 @@ std::vector<SharedGenericEventPointer> EventListener::getEvents() {
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(output.begin(), output.end(), [](const SharedGenericEventPointer& a, const SharedGenericEventPointer& b) {
|
||||
std::sort(output.begin(), output.end(), [] (const SharedGenericEventPointer& a, const SharedGenericEventPointer& b) {
|
||||
return a->id < b->id;
|
||||
});
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Bloom
|
||||
void registerCallbackForEventType(std::function<void(const EventType&)> callback) {
|
||||
// We encapsulate the callback in a lambda to handle the downcasting.
|
||||
std::function<void(const Events::Event&)> parentCallback =
|
||||
[callback](const Events::Event& event) {
|
||||
[callback] (const Events::Event& event) {
|
||||
// Downcast the event to the expected type
|
||||
callback(dynamic_cast<const EventType&>(event));
|
||||
}
|
||||
@@ -242,7 +242,7 @@ namespace Bloom
|
||||
}
|
||||
|
||||
Events::SharedGenericEventPointer foundEvent = nullptr;
|
||||
auto eventsFound = [&eventTypes, &eventQueueByType, &correlationId, &foundEvent]() -> bool {
|
||||
auto eventsFound = [&eventTypes, &eventQueueByType, &correlationId, &foundEvent] () -> bool {
|
||||
for (const auto& eventType : eventTypes) {
|
||||
if (eventQueueByType.find(eventType) != eventQueueByType.end()
|
||||
&& !eventQueueByType.find(eventType)->second.empty()
|
||||
|
||||
Reference in New Issue
Block a user