Avoid owning raw pointers. Even without exceptions, they are prone to leak.
Use a sensiblestd::unique_ptr,std::anyorstd::variant. The latter even avoid extra dynamic allocations, though at the cost of potentially wasting a small amount of memory.Are you sure there's always at least one person?
Deduplicator
- 19.9k
- 1
- 32
- 65