-
Notifications
You must be signed in to change notification settings - Fork 6
Reduce the use of std::shared_ptr<> where possible #23
Copy link
Copy link
Open
Labels
effort: 3Requires average effort to completeRequires average effort to completepriority: soonUse for urgent problemsUse for urgent problemstype: performance-improvementThe issue, when solved, comes with a performance boostThe issue, when solved, comes with a performance boostwork: complicatedCynefin complicated: the work involves problems without necessarily one preferred methodCynefin complicated: the work involves problems without necessarily one preferred method
Metadata
Metadata
Assignees
Labels
effort: 3Requires average effort to completeRequires average effort to completepriority: soonUse for urgent problemsUse for urgent problemstype: performance-improvementThe issue, when solved, comes with a performance boostThe issue, when solved, comes with a performance boostwork: complicatedCynefin complicated: the work involves problems without necessarily one preferred methodCynefin complicated: the work involves problems without necessarily one preferred method
We use the C++11
std::shared_ptr<T>templated type to achieve some level of automatic reference counting. While storing references to transitions and objects benefits from the use of shared pointer, we should eliminate passing shared pointers, where possible, as arguments to functions and methods and instead pass the raw value directly. This will make the function declarations smaller and reduce any unnecessary reference counting inside each of the function calls. Furthermore, dereferencing the shared pointers requires one or two extra steps of indirection which would be avoided with raw pointers