examples/signal: use ConstCharRange

master
Daniel Kolesa 2016-05-08 23:25:11 +01:00
parent a5c4b9d3ca
commit ccaedf80dc
1 changed files with 4 additions and 4 deletions

View File

@ -9,8 +9,8 @@ struct SignalTest {
* can actually emit (in that case, the reference passed to each * can actually emit (in that case, the reference passed to each
* callback will always be const to make sure nothing changes) * callback will always be const to make sure nothing changes)
*/ */
Signal<const SignalTest, int, const char *> on_simple = this; Signal<const SignalTest, int, ConstCharRange> on_simple = this;
Signal< SignalTest, float > on_param = this; Signal< SignalTest, float > on_param = this;
SignalTest(): p_param(3.14f) { SignalTest(): p_param(3.14f) {
/* we can connect methods */ /* we can connect methods */
@ -31,7 +31,7 @@ struct SignalTest {
on_simple.emit(150, "hello world"); on_simple.emit(150, "hello world");
} }
void simple_method(int v, const char *str) const { void simple_method(int v, ConstCharRange str) const {
writefln("simple method handler: %d, %s", v, str); writefln("simple method handler: %d, %s", v, str);
} }
@ -49,7 +49,7 @@ int main() {
* this callback can access "test" easily and it will still work * this callback can access "test" easily and it will still work
*/ */
auto idx = st.on_simple.connect([&](const SignalTest &, int v, auto idx = st.on_simple.connect([&](const SignalTest &, int v,
const char *str) { ConstCharRange str) {
writefln("and lambda test: %d, %s (%d)", v, str, test); writefln("and lambda test: %d, %s (%d)", v, str, test);
}); });