On 04/05/2015 11:01 AM, Georg Baum wrote:
Georg Baum wrote:

All ArgumentProxy instances are contained in MathMacro::expanded_, which
means that there is always a unique parent-child like relationship between
MathMacro and ArgumentProxy. Therefore, a single place exists where
ArgumentProxy::mathMacro_ can become invalid, and where it could be
updated: Whenever a MathMacro object is copied. Therefore we can simply
create a user defined copy constructor and assignment operator for
MathMacro, and update all ArgumentProxy::mathMacro_ references after
copying the macro. That's it! With this simple fix we do not require
anymore the additional property of RandomAccessList that resizing never
copies the elemnts. Furthermore, the fix also helps in cases where the
complete MathMacro::expanded_ vector is copied, which would not be fixed
by converting it to a RandomAccessList only.

The drawback of that approach is that it is easy to forget to update the
copy constructor and assignment operator when adding new members.
Therefore I'd like to use a pimpl, so that the pimpl copies can be
compiler generated, and the manual operators do not need to be touched in
the future. This looks like the attached lengthy patch. If I don't get
complaints I'd like to put this into master, and for 2.1 I'd like to do
the same, but in order to minimize the changes without the pimpl, i.e.
with a manual copy constructor and assignment operator.
This is now in master.

Richard, for 2.1 I propose the attached solution without pimpl. I do not
want to change too much code, and I don't expect any new memeber variables
in 2.1 anymore. OK?

Yes, that is fine.

rh

Reply via email to