Open jimfoltz opened 6 years ago
No, I don't believe so, as that ref 'becomes owned' by the String object on this line: https://github.com/TommyKaneko/Sketchup-API-C-Wrapper/blob/3f06f164448163b92bb12161bb694115899d056d/src/SUAPI-CppWrapper/model/RenderingOptions.cpp#L41
It would release the ref when the String object goes out of scope and destroys at the end of the function call.
So all Ref objects passed into the wrapper makes the wrapper take ownership?
Side note: emplace_back
can often be faster than push_back
. With C++11 and newer it's generally the insertion method to reach for.
Mostly yes. Most wrapper constructors have an optional "attached" parameter when passing in a Ref object. This flag is held as a member variable, and indicates whether the ref object needs to be released on wrapper object destruction.
Will get into the habit of emplace_back - thanks for tip.
https://github.com/TommyKaneko/Sketchup-API-C-Wrapper/blob/3f06f164448163b92bb12161bb694115899d056d/src/SUAPI-CppWrapper/model/RenderingOptions.cpp#L34
So this vector goes away at the end of the function call, correct? Does each element need
SUStringRelease
?