You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the Menu::Insert method does not work with std::bind (and unfortunately it does not work with free functions, either).
While I understand why free functions are not accepted (they don't have operator () as required by the Menu::Insert method), I must investigate deeply why std::bind is not accepted.
My idea would be to fix this issue (for both cases).
Of course, in the meantime, you can wrap your method call in a lambda as a workaround:
rootMenu->Insert(
"test",
[this](std::ostream& out)){ this->Test(out); },
"this is a test"
);
If you like this library add a star (we're almost at 500 :-) ) and please consider becoming a sponsor to support our work by clicking the heart button at the top of the page :-)
daniele77
changed the title
Is it possible to bind a member function to Menu?
Menu::Insert method does not work with free functions and with std::bind.
Jan 28, 2021
Hi,
Thanks for this great work, One thing I've tried to achieve is to bind a member function to the Menu, but I'm getting an error message:
error C2661: 'cli::Menu::Insert': no overloaded function takes 5 arguments
Am I doing something wrong? No matter how I tried always this error.
Is it possible to bind a member function instead of a lambda function?
Thanks
The text was updated successfully, but these errors were encountered: