Skip to content

Use variadic templates for tl::event - #2478

Closed
nikosavola wants to merge 4 commits into
KLayout:masterfrom
nikosavola:pr-tl-events-variadic
Closed

nikosavola wants to merge 4 commits into
KLayout:masterfrom
nikosavola:pr-tl-events-variadic

Conversation

@nikosavola

Copy link
Copy Markdown
Contributor

- deleting an event from a receiver of a nested emission only flagged the innermost emission, so the outer one kept calling receivers and touched freed members
- every active emission is tracked with a guard object, which also covers a receiver that deletes the event and then throws
- copying an event does not copy its active emissions
- the six macro instantiations of the event classes become variadic templates (about 140 lines less), `tlEventsVar.h` is gone
- stacked on the nested emission fix
@nikosavola
nikosavola marked this pull request as draft October 1, 2026 19:25
@klayoutmatthias

Copy link
Copy Markdown
Collaborator

Maybe it's time to switch to variadic templates. But even today, RHEL 7 is still used by many enterprise installations which comes with gcc 4.8 - the first version that supported variadic templates. And there is even Qt4 in place.

Matthias

@nikosavola

Copy link
Copy Markdown
Contributor Author

I tested this on CentOS 7 with gcc 4.8.5 and -std=c++11. tl builds without Qt and all tlEvents tests pass. I did not try a full Qt4 build. But this is plain C++ in tl, and Qt4 and Qt5 builds already use -std=c++11. So RHEL 7 should be fine. It is your call.

@nikosavola nikosavola closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants