[GiNaC-devel] Questions about expairseq::match().

Alexei Sheplyakov varg at theor.jinr.ru
Tue Jul 15 18:58:39 CEST 2008


Dear Jens,

On Tue, Jul 15, 2008 at 08:58:09AM +0200, Jens Vollinga wrote:

> see
>    http://www.ginac.de/pipermail/ginac-devel/2006-April/000942.html
> for an explanation.

Thanks, now I understand my mistake.

> > This fragment looks a bit confusing. it->match(p, repl_lst) can change
> > repl_lst, so iterators become invalid. Fortunately, in that case match
> > returns true, so we jump out of the loop.

This statement is incorrect. The manual (ginac.texi) says:

4419 This function returns @code{true} when the expression matches the pattern
4420 and @code{false} if it doesn't. If used in the second form, the actual
4421 subexpressions matched by the wildcards get returned in the @code{repls}
4422 object as a list of relations of the form @samp{wildcard == expression}.
4423 If @code{match()} returns false,  @code{repls} is undefined.

I propose to change this (a bit confusing) behaviour and leave repls
unchanged if the expression does not match the pattern.

Best regards,
	Alexei

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-devel/attachments/20080715/c6814282/attachment.sig 


More information about the GiNaC-devel mailing list