camp icon indicating copy to clipboard operation
camp copied to clipboard

Type erased resource and event implementation

Open MrBurmark opened this issue 1 year ago • 1 comments

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?

MrBurmark avatar Dec 08 '23 18:12 MrBurmark

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.

trws avatar Dec 08 '23 23:12 trws