Jules I need your help winning an argument that it is not worth writing
The person in question seems to think that somehow the first version is more “optimal” in terms of performance, even though the function in question is only called tens of thousands of times per second (or does it even matter how much it is called)?
My issue is that the version which takes a const reference forces the additional invariant that the object must not lose its last reference (this can only happen in a concurrent scenario). I would rather pass the shared pointer by value, so that the function holds a reference to the object. But this guy thinks its less optimal…premature optimization? How can I reason with him and prevail?
Note that boost::shared_ptr is functionally equivalent to ReferenceCountedObject.