[pooma-dev] [Q] Field/Relations/RelationList.h:makeOwnCopy()

Richard Guenther rguenth at tat.physik.uni-tuebingen.de
Wed Jan 29 19:42:32 UTC 2003


On Wed, 29 Jan 2003, Richard Guenther wrote:

> Thinking more about it it seems you need the
> RelationList::makeOwnCopy(Target&) Target parameter only for the type of
> the current target (which is the only one expected to be passed) and use
> the retarget() machinery to clone the list item.
>
> The same goes with FieldEngine::makeOwnCopy() which needs to pass down
> the subject (of Field type)...

Actually this caused me thinking about Fields and Relations some more and
I believe the current code is as correct as it can be. I.e. both the
parameter to makeOwnCopy() and the retarget operation is actually
necessary. BUT - there is no way we can make this work in all cases,
consider:

  Field<...> a;
  Field<... View<..> > b(a);

  ... add some relations to a ...

  a.makeOwnCopy();

  ... now we're left with b having relations with still a as target :(

so strictly we need to add some asserts to FieldEngine::makeOwnCopy,
somethig like

  &s != any of the relation targets || no relations || fieldengine not shared

all in pseudocode, as these are not simple tests.

At least we ought to document that unsharing the target of relations leads
to undefined behavior.

Or am I wrong again?

Richard.




More information about the pooma-dev mailing list