
17 Mar
2011
17 Mar
'11
7:08 p.m.
On 3/17/2011 2:13 PM, pavel wrote:
and at last can you please give a couple of reasons why delete'ing smart pointers is a bad idea?
Because it's a lie. "delete" should delete something, and not be overloaded to perform non-obvious, unrelated logic. A perfect example is how the proposed usage of "delete" confused Frank Mori Hess. Was it unreasonable for him to see "delete" and assume that it was actually deleting something? On 3/17/2011 2:13 PM, pavel wrote:
furthermore this can simplify template programming here is an example
template<typename ptr_t> void takes_ownership(ptr_t p) { //do something with the data delete p; }
The same can be accomplished using type traits or function overloading.