Boost logo

Boost Users :

From: Andrew Holden (aholden_at_[hidden])
Date: 2006-07-10 15:06:28


True. I would not expect a guarantee that malloc/free would be suitable
for objects, since they came from a language that doesn't have objects.
I was merely looking for a way to demonstrate manually calling both the
constructor and destructor without calling either twice, and that
happened to work on my platform, and I think will probably work on most.

 

Well, that and I didn't know you could use operator new and operator
delete like this. We all learn something new every day.

 

  _____

From: Michael Nicolella [mailto:boost_at_[hidden]]
Sent: Monday, July 10, 2006 2:54 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] std::vector< boost::shared_ptr<int>
>::pop_back()

 

I would avoid malloc() and prefer the global operator new... I'm not
sure if the standard guarantees that memory allocated with malloc is
suitable for constructing an object in. My guess is there's no such
guarantee, but there is that guarantee for operator new. Or maybe I'm
off my rocker.



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