CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 24

Threaded View

  1. #4
    Join Date
    Feb 2005
    Location
    "The Capital"
    Posts
    5,306

    Re: Using delete on an object without new

    One ocassion where in I wanted something like that was when I had 2 code paths and each led to either a pointer to an object on the stack or the free-store and it was a tough to find out when it was pointing to what and correspondingly choose to call delete or not (without adding a state). So, I opted to change the naked pointer usage with a shared_ptr with the deleter set to a noop routine which I used in case the pointer was to the stack object else it had the default deleter as delete in cases it were pointing to the free store. But, I did not need to use delete explicitly as the OP is requesting for. So, not sure what he actually needs that for.
    Last edited by exterminator; December 29th, 2008 at 04:48 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured