Create a boost::shared_ptr to an existing variable
although you should put the variable into a managed pointer on it’s creation to do it from an existing pointer. int *a=new int; boost::shared_ptr<int> a_ptr(a); That said you most definitely do not want to be putting stack variables into shared_ptr BAD THINGS WILL HAPPEN If for some reason a function takes shared_ptr and you only … Read more