NoAvailableAlias / nano-signal-slot

Pure C++17 Signals and Slots
MIT License
407 stars 60 forks source link

Why `connect<Foo, &Foo::handler_a>(&foo)` syntax? #8

Closed cubuspl42 closed 9 years ago

cubuspl42 commented 9 years ago

It's more verbose than connect(&foo, &Foo:handler_a) syntax used by some other signal-slot libraries. Does it add any measurable performance benefit? To be honest, this weird connect syntax and nondeterministic emission order are the only two things that separate nano from perfection. I'd love to use it in my project if those two issues were addressed.

NoAvailableAlias commented 9 years ago

The syntax is the result of a design decision to use non-type template parameters. This allows for negotiating some issues with overload deduction for slots by allowing you to explicitly specify which overload you are looking for. Additionally the delegate implementation used depends on this syntax and will not work with template deduction.

The master branch is still deterministic (albeit based on the slot location in memory), but the FT branch uses a singly linked list as the underlying data structure and will emit slots in FIFO order. Sometime soon I would like to merge the FT branch with master but have been giving the FT branch some time.

NoAvailableAlias commented 9 years ago

Closing this item, master branch has been merged with FT. Slot emission now has ordering.