This is fine in your example, since you are making a copy of int .
If you get int as a link, then after this line it will be a chatty link, since the general pointer will go out of scope by deleting it.
Is it also a bad idea to use shared_ptr to avoid copying the whole object? As a vector of matrices / images, for example.
Using shared_ptr will prevent copying, since using an open pointer will avoid copying - decide if you want to avoid copying (first), and then choose which type of pointer you should use.
For matrix or image vectors, you can use std::vector from boost::shared_ptr , or boost::ptr_vector , or some other container that simplifies memory management.
source share