cesium-unity
cesium-unity copied to clipboard
Disable copy constructor / assignment operator on *Impl classes
CesiumGS/cesium-unity#207 was caused by accidentally copying a CesiumIonSessionImpl instance. This is easy to do because copying the generated C# wrappers, such as CesiumIonSession, is normal and safe and expected (because they act like references to C# classes), while doing the same with the Impl classes is dangerous and almost always incorrect.
We can detect and prevent bugs like this by declaring the copy constructor and assignment operator as deleted in the Impl classes. We can easily do this without a lot of boilerplate or any runtime cost by introducing a base class that our Impl classes inherit from.