Skip to content
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

Type erased resource and event implementation #144

Open
MrBurmark opened this issue Dec 8, 2023 · 1 comment
Open

Type erased resource and event implementation #144

MrBurmark opened this issue Dec 8, 2023 · 1 comment

Comments

@MrBurmark
Copy link
Member

My understanding is that these are supposed to be fairly light weight classes. I think resources are trivial most of the time, but events may need to own their data.
The type erasure is currently implemented with inheritance and shared_ptr. Does it make sense to use std::variant when we move to c++17?

@trws
Copy link
Member

trws commented Dec 8, 2023

The main trick really is dealing with the lifetime and single cleanup issue. Using variant would remove the atomic on each copy, so that would be nice and might be worth a try. The semantics would be a bit different, but we don't do anything on destruction so it should work out. Might even be fine to use std::any now that I think about it, bit different tradeoff, worth trying I think.

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

No branches or pull requests

2 participants