[GiNaC-devel] Archiving an empty container
Vladimir V. Kisil
kisilv at maths.leeds.ac.uk
Tue Sep 10 12:19:48 CEST 2019
Dear Richard,
Thanks for commenting on the previous patch, I appreciate the
point on preserving return values of public methods.
I am attaching an another patch using an additional method. It is as
close to the standard checks (it != list.end()) as I can imagine.
Best wishes,
Vladimir
--
Vladimir V. Kisil http://www.maths.leeds.ac.uk/~kisilv/
Book: Geometry of Mobius Transformations http://goo.gl/EaG2Vu
Software: Geometry of cycles http://moebinv.sourceforge.net/
Jupyter (Colab): https://github.com/vvkisil/MoebInv-notebooks
Jupyter (CodeOcean): http://doi.org/10.24433/CO.9934595.v2
>>>>> On Tue, 10 Sep 2019 10:27:16 +0200, "Richard B. Kreckel" <kreckel at in.terlu.de> said:
RK> Hi Vladimir, On 09.09.19 16:07, Vladimir V. Kisil wrote:
>> There is an issue with GiNaC archiving an empty container. This
>> is illustrated by the code included below. The archived empty
>> list z is read in the expression z1 as a list with one
>> element. Also such code can crashes id an empty container is
>> archived first.
>>
>> The reason is in lines 215-216 of container.h: here GiNaC got
>> first=last for both: empty containers and containers with one
>> element.
RK> Thanks a lot for researching and reporting this!
>> I propose the attached patch, which modifies the return value of
>> archive_node::find_last() (called at line 216 of container.h) by
>> 1. All other calls of archive_node::find_last() are revised to
>> agree with the change.
RK> I'm not convinced that changing archive_node::find_last(name) to
RK> return an iterator to a property beyond the one searched for is
RK> the right fix.
RK> It might break existing code. Also, it's not intuitive in the
RK> presence of archive_node::find_first(name). This is not like
RK> T::begin() and T::end() - notice the different naming!
RK> Would it not be better to add something to the interface of
RK> class archive_node, like an empty() function or so?
RK> All my best, -richy. -- Richard B. Kreckel
RK> <https://in.terlu.de/~kreckel/>
RK> _______________________________________________ GiNaC-devel
RK> mailing list GiNaC-devel at ginac.de
RK> https://www.cebix.net/mailman/listinfo/ginac-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-archive_node-is_within_props-methods.patch
Type: text/x-diff
Size: 3162 bytes
Desc: Additional function and fixing emty containers
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20190910/2f021420/attachment.bin>
-------------- next part --------------
More information about the GiNaC-devel
mailing list