
12 May
2008
12 May
'08
9:43 a.m.
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