[Development] Proposal: adding overloads to pre-existing member functions is ok as long as not a slot

Thiago Macieira thiago.macieira at intel.com
Tue Jul 28 02:13:18 CEST 2026


On Monday, 27 July 2026 03:20:07 Pacific Daylight Time Marc Mutz via 
Development wrote:
> The std already forbids taking the address of (any, not just member)
> function, and the solution is to wrap the call in a lambda and pass that
> instead (which may decay to a function pointer, if needed).
> 
> So, yes, we may want to tell users not to take addresses of
> non-signal/non-slot Qt functions, member or not.

The connection mechanism is slightly more efficient when you pass a function 
pointer, member or not, because it can tell what arguments you meant to 
receive. When you pass a functor/lambda, the receiver may itself have 
overloads or may be a template, so we can't do that. That means we can't look 
at the receiver's arguments to do interesting things; instead, we must try 
things and see if they compile.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCG - Platform & Sys. Eng.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5176 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20260727/cc4a9b22/attachment.bin>


More information about the Development mailing list