Re: Reference, but object unchanged?
On Oct 28, 10:53 pm, Kai-Uwe Bux <jkherci...@gmx.net> wrote:
You must be kidding. Since when does a node have a non-trivial
destructor.
I think that can happen in any graph whose nodes carry labels.
In particular, if the nodes have labels that involve
containers like std::vector<> or std::string<>, then the
question arises as to how the garbage collector interacts with
the allocator used by the container. I would also contend that
at least string labeled nodes are not uncommon.
Good point. Obviously, you have to configure things so that the
garbage collector also collects memory allocated by such
containers.
The simplest solution is simply to route all allocations to the
garbage collector, and let it take care of all deallocations.
Delete still works as usual, of course, but you rarely need it,
except for entity objects with an explicit lifetime. This
doesn't work if you have third party libraries which "mask"
pointers in some way, of course, but such libraries are fairly
rare.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34