|
Boost Users : |
From: Nevin \ (nevin_at_[hidden])
Date: 2008-05-16 18:47:01
2008/5/16 Noah Roberts <roberts.noah_at_[hidden]>:
> I don't like this idea. You are creating a dependency on the fact that
> the called function will NOT keep a copy - or you are insisting that the
> object in question implement the shared_from_this model. If you later
> decide that it would be prudent for the function or object in question
> to create or pass a kept copy of this object then you'll have to change
> the signature of the function and then each and every call to it (to
> remove get() calls).
If this were Java, I might agree.
Given your assumption, I don't see how you can pass pointers to stack
variables, pointers to member variables, pointers to objects in STL
containers, etc., to any function, because it is not possible for those
functions to know, let alone change, the lifetime of those objects.
Do you really allocate every single variable in your program on the heap and
store it in a shared_ptr, just in case?
Regards,
-- Nevin ":-)" Liber <mailto:nevin_at_[hidden]> (847) 691-1404
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net