Boost logo

Boost Users :

From: Kevin Martin (kev82_at_[hidden])
Date: 2008-05-12 05:43:04


I have just discovered to my delight that you can use shared_ptr with
a null deleter to pass around stack based objects. This is great
because a function shouldn't care whether a parameter passed to it is
on the heap or stack. So I can write general functions to accept a
shared_ptr and if I have to pass a stack based object I can just pass
a null deleter.

My question is whether the boost library has anywhere in it a null
deleter object, or whether it is possible to define one in place with
boost::lambda or similar? It seems silly that something that I imagine
would be needed quite commonly is not included in the library.

Thanks,
Kevin Martin


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