4 ms·
> often can't be used because objects need to be passed by reference to libraries that use regular-old-pointers. I don't understand what you mean by this. If y
by rmartinho 14y ago
> often can't be used because objects need to be passed by reference to libraries that use regular-old-pointers.
I don't understand what you mean by this. If you have a `smart_ptr<T> p;` nothing prevents you from passing `*p` or `p.get()` to some legacy interface. You only have trouble if that legacy interface wants to claim ownership of the object.
- ben0x539 14y agoI think the issue is that the typedef is intended to hide the smartptrness so it's not obvious what the API for getting an old-style pointer is, or whether getting an old-style pointer is even part of the intended public interface anymore (beyond p.operator->() anyway ;)
- radarsat1 14y ago> You only have trouble if that legacy interface wants to claim ownership of the object. That's exactly what I mean. This happens. My point is just that even the best intentions are easily subverted in a real-world scenario where you didn't write the whole codebase yourself from scratch.