Menu

#16 Inappropriate passing of shared pointers by non-const reference

None
closed-fixed
None
9
2015-03-05
2015-03-05
No

Matt Calderon points out that various functions (i.e. torc::physical::Circuit::addInstance()) take non-const shared pointer references as parameters. This is dangerous because it can lead to incorrect reference counting by the shared pointer.

Based on the discussion in http://stackoverflow.com/questions/3310737/shared-ptr-by-reference-or-by-value and http://stackoverflow.com/questions/8385457/should-i-pass-a-shared-ptr-by-reference, the shared pointers are now passed as const shared pointer references.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB