palacaze / sigslot

A simple C++14 signal-slots implementation
MIT License
709 stars 97 forks source link

Getter for number of connected slots #10

Closed Dysl3xik closed 4 years ago

Dysl3xik commented 5 years ago

Would it be possible to add a getter to return the number of connected slots?

I think this could also be used in your emit code to skip making a copy of the vector or slots if there are no slots connected.

palacaze commented 5 years ago

Hi,

There is no actual copy happening in the emit code in that case, thanks to the copy on write mechanism in place. The COW object will only copy the slot list if it is being written at the time of emission, which will not happen if no slot is connected.