Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/larspensjo/SimpleSignal
High performance C++11 signals
https://github.com/larspensjo/SimpleSignal
Last synced: about 2 months ago
JSON representation
High performance C++11 signals
- Host: GitHub
- URL: https://github.com/larspensjo/SimpleSignal
- Owner: larspensjo
- Created: 2013-12-02T08:12:37.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2019-07-24T10:57:35.000Z (over 5 years ago)
- Last Synced: 2024-08-04T02:09:47.926Z (5 months ago)
- Language: C++
- Size: 21.5 KB
- Stars: 160
- Watchers: 13
- Forks: 42
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- AwesomeCppGameDev - SimpleSignal
README
# High performance C++11 signals
See [Performance of a C++11 Signal System](http://www.testbit.eu/2013/cpp11-signal-system-performance/) for
the original source code, as well as performance measurements compared to other signalling systems.The original author, Tim Janik, licensed the source code to the public domain [CC0 1.0 Universal (CC0 1.0)](http://creativecommons.org/publicdomain/zero/1.0/).
## Declare a signal
This example declares a signal 'sig' that takes three arguments and returns a char.
```c++
Simple::Signal sig;
```
## Connect to a signal
This example connects 'sig' to a static function.
It is also possible to connect to member functions or lambda functions.
```c++
static char float_callback (float f, int, std::string) {
// ...
return 0;
}void Init() {
sig.connect(float_callback);
}
```
## Fire a signal
```c++
void func() {
// ...
sig.emit(1.0f, 7, "xxxx");
}
```