-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernize for C++20 and clean up code
- Loading branch information
Showing
16 changed files
with
131 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
#include <PubBus/PubBus.hpp> | ||
#include <iostream> | ||
|
||
struct DummyMessage : public pub::Message | ||
struct DummyMessage : pub::Message | ||
{ | ||
int important_value = 0; | ||
}; | ||
|
||
int main() | ||
{ | ||
auto bus = pub::MessageBus{}; | ||
auto msg = DummyMessage{}; | ||
msg.important_value = 100; | ||
const auto message = DummyMessage{ .important_value = 100 }; | ||
|
||
bus.subscribe<DummyMessage>( | ||
[](DummyMessage msg) | ||
[](const DummyMessage message) | ||
{ | ||
std::cout << "Important value: " << msg.important_value << "\n"; | ||
std::cout << "Important value: " << message.important_value << "\n"; | ||
} | ||
); | ||
|
||
bus.publish(msg); | ||
bus.publish(message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.