[GiNaC-list] Collect() with a list of variables doesn't work in ginsh
Richard B. Kreckel
kreckel at in.terlu.de
Wed Mar 24 00:28:35 CET 2021
On 22.03.21 22:03, Richard B. Kreckel wrote:
> On 22.03.21 10:32, Vitaly Magerya wrote:
>> On 21/03/2021 13:10, Richard B. Kreckel wrote:
>>> Does the attached patch work for you?
>>
>> Yeah, that seems to work.
>
> Great!
The little "beauty" attached to this email fixes it, too.
What happens is that, within basic::collect(const ex& s), s.operator[i]
calls ex::operator[](size_t) const, i.e. the const overload, as the
author apparently expected. So far, so good.
But, contrary to what the author of said operator[] expected, it does
not call basic::operator[](size_t) const for two slightly surprising
reasons:
1) ex::bp is of type ptr<basic>, not of type const ptr<basic>,
2) ptr<basic>::operator*() returns a basic &, not a const basic &.
Well, this is @%o&X#$* brain-dead.
-richy.
--
Richard B. Kreckel
<https://in.terlu.de/~kreckel/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: indexing-const.patch
Type: text/x-patch
Size: 621 bytes
Desc: not available
URL: <http://www.ginac.de/pipermail/ginac-list/attachments/20210324/101da399/attachment.bin>
More information about the GiNaC-list
mailing list