[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (OT) Re: memory management



Keith Lucas wrote:

On a more serious take:

> I've tried it and honestly wouldn't recommend it. For one thing, a base
> object heavyweight enough to support persistence and so on is probably
> overkill for the kinds of lightweight objects you want to be throwing around
> inside the program (bear in mind you're going to want to return things by
> value sometimes).

Personally, here's my base object:

class Object {
public:
  virtual ~Object {};
};

Is that lightweight enough for you? Does two things: enables general
containers by having a type compatible with all the other ones and makes
destructor works correctly (damn C++, why isn't "virtual" the friggin'
DEFAULT???).

-- 
Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi