-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
signal_type add a rvalue operator #4
Comments
Hello, If I were to add the implementation to the library, the code below will fail catastrophically since the first slot will consume the argument: auto lambda =
[&]( std::unique_ptr<int> value ) {
std::cout << *value << std::endl;
};
nod::signal<void(std::unique_ptr<int>&&)> signal;
signal.connect( lambda );
signal.connect( lambda );
signal( std::make_unique<int>( 5 ) ); When I get some more time to sit down, I'll look into this some more. If you don't mind me asking, what are the situation where you need the rvalue version? |
hello, nod::signal<void(string&&)> signal;
signal.connect([](string&& i){});
signal(string("")); so i have to add a rvalue version. |
Yes I understand that your code will not compile. I'm curious about the situation where you need a signal with a rvalue argument. Will you move arguments into your signals? What happens if that signal has multiple slots connected when it is triggered? |
I konw your meaning. a rvalue argument in this situation is meaningless. I think you could give some advice to user, maybe somebody makes a mistake. |
I'm closing this issue as it's not implementable, but the issue lives on in issue #12 |
hi, the signal_type's opertator is just surpport lvalue, it need a rvalue version, like this.
The text was updated successfully, but these errors were encountered: