-
Notifications
You must be signed in to change notification settings - Fork 76
Add signal connect helpers #107
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
Add signal connect helpers #107
Conversation
|
It seems that removing So, is it a problem if |
|
Does anyone really need 11 overloaded sigc::signal_connect() functions? If you don't need them yourself, I suggest you skip some of the signal_connect() overloads.
Problem 1 (clang does not accept the overloads with sigc::mem_fun() is more
No, I don't see why it would be a problem. |
|
To be honest, I made the 11 overloaded versions for coherency purpose to meet (hopefully) all cases with only one function.
I personally only need the ones for the overridden methods. My project (which uses sigc++) already has some of those helper functions. So I don't really need them. I though they could be helpful to someone else.
OK (and I had forgotten
I discovered the meaning of volatile after have found that So, I'll remove them too.
and
I was unclear in my second message... sorry. Removing
I encountered the GCC error I'll do the fix and squash my commits into one. Before I forget, what about the documentation update, do you have some hints? |
fdc28bb to
c698633
Compare
|
So, here are the 6 remaining overloaded
tests have been reworked too. |
c698633 to
e269218
Compare
|
I had forgotten to remove the unneeded |
|
Have you tested your new code, including test_signal_connect.cc, with MSVC? Add to sigc++/sigc++.h: The copyright year of the new files shall be 2024. When I build with -Dwarnings=fatal, I get the errors:
sigc::signal_connect() shall be members of the signal_base.h contains a comment starting with |
e269218 to
5307029
Compare
|
I don't have found a way to make MSVC accepts the And thanks you for the hints about the workflow and for the documentation. I saw that Doxygen's |
…methods to signals Those helper functions have 2 main usages: * avoid writing template parameters in case of method or function overloading; * wrap use of sigc::mem_fun or sigc::ptr_fun when possible. unsupported cases: * lambda functions; * std::function (or alike); * volatile functions; * const? volatile methods; * binding with sigc::bind.
5307029 to
33b8e68
Compare
|
I had forgotten to write a test for To make it work, the template parameter list must have a But as Clang does not like it (the problem 1 in my first message), I have no choice to do this big |
|
thanks for all |
|
I forgot to mention It's worrying that different compilers require different sets of template parameters. |
|
And Github's workflows only support GCC, Clang, MSVC, or MacOs's Clang flavour... no even ICC... If you prefer to revert my PR to avoid such worries, don't hesitate ;) I'll give a try with clang's folks. |
|
Thanks for the minors changes I missed (and the I opened the issue llvm/llvm-project#107111 for the compiler based #if/else/endif I introduced. |
After discussion in #104, there are finally more than 3 versions of
signc::signal_connect(...):sigc::ptr_fun(...)for function pointers;sigc::bind(sigc::ptr_fun<...>(...)for function pointers with partially or totally bound arguments;sigc::mem_fun(...)for methods (one for each the non-cv one and the 3 cv ones);sigc::bind(sigc::mem_fun<...>(...)for methods (for the same reason).I think the test program can be used as a good showcase (instead of writing an example program) and I don't have any changes for the documentation yet.
But I face 2 problems (hence the WIP prefix):
sigc::mem_fun(...)with overloaded methods while GCC does.sigc::bind(sigc::mem_fun<...>(...)while they acceptsigc::bind(sigc::ptr_fun<...>(...).By GCC, I mean GCC 13.3 and 14.2 and for Clang, I used 16.0.6, 17.0.6, and 18.1.8.
For 1, the message is:
and I can not find a way to get around it... I can only think that Clang consider implicit conversion while searching a candidate while GCC does not...
for 2, the messages are (for GCC):
and (for Clang):
I can not figure what make one build and not the other...
So, this PR has 2 commits: the first with all but the
sigc:bindversions (but still with problem 1), the second with thesigc:bindversions ofsigc::signal_connect(...). To make the later fails, the calls tosigc::signal_connect(...)intest_signal_connect_partial_bind_method()and intest_signal_connect_total_bind_method()have to be uncommented.Any feedback or hints are welcome
best regards