manish bhatia wrote:
>>     s.~string();
>>
>>     delete[] mem;
>> }
> 
> You shouldn't be calling destructors directly! What in the world are
> you trying to accomplish here?
> 
> -- Brett
>  
> Hi Brett,
>  
> Yeah, it's a little unwarranted code. Lets just say that I am experimenting 
> with placement new. How do you think I can accoplilsh this, i.e. calling the 
> distructor without exposing std::string?

Placement new and delete are considered to be advanced C++ topics.  I've 
only used them one time ever (in Block).  You have to be incredibly 
careful when using them.  In particular, memory leaks (and some crashes) 
become very difficult to track down.

There are usually (not always but usually) better ways to go about doing 
something wherever placement new/delete are used.  Placement new/delete 
should be the absolute last-ditch solution to a problem.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to