Using Boost Signals2 to pass messages, return true to cancel propagation
✓ Published0🌍 Public
RRandomEtc
Last edited Dec 8, 2011
Created on Dec 7, 2011
This example demonstrates how to cancel signal propagation in Boost Signals2 by using a custom combiner that inspects an event object and stops iteration when `stopPropagation()` is called. It shows three widget slots connected to a single signal, with a goat-canceling widget that halts delivery of "goat" events to subsequent slots, while other event types like "otter" and "badger" propagate normally. The code defines a `MyCombiner` struct that checks the event’s `shouldStopPropagation()` flag between slot invocations, and also uses `shared_connection_block` to temporarily suppress a slot. The output confirms that only widgets 1 and 2 receive goat events, while all three receive otter and badger events.
AI-generated description