mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-20 02:27:48 +08:00
ChaiScript 6 always used a shared_ptr to wrap C++ objects created in ChaiScript. Newer versions avoid this by only wrapping objects that cannot be copied. This has the side effect that ChaiScript depends on correctly implemented C++ copy and move constructors in unexpected locations. I don't think the reduced overhead (by avoiding the shared_ptr) justifies the new behavior in every case. Therefore, I suggest we temporarily only perform this optimization if the class is trivially destructible, until unexpected copies and moves in ChaiScript are fixed (if this is even possible), or there is a sanitizer/compiler warning that can detect these cases. Before the change the following code will call the ctor once, move once, and the dtor twice: auto obj = MoveableObject(); After this change it will only call the ctor once and the dtor once. |
||
|---|---|---|
| .. | ||
| chaiscript | ||