* Monty Taylor <mordred@stripped> [09/02/27 10:21]:
> > My C++ skills have faded given what I work on. What does C++ have that
> > is similar to mem_root? That is, I want an allocator to be used with a
> > variety of STL classes for which I will deallocate everyting all at
> > once but at some random point in the future. And since I don't want to
> > have to retain handles to everything that has been allocated, I prefer
> > to invoke deallocate on the allocator rather than all of the objects
> > that have been allocated from it.
>
> No. C++ does not have a thing that behaves exactly like mem_root does.
> You could build one, but it would be (and is) a bad idea, because things
> you're allocating in C++ are objects, and you need to run destructors on
> them, and because then you'd be trying to program idiomatic C in C++.
Memory life cycle != object life cycle. Mark, you need to look at
STL allocators.
--

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.