[GiNaC-list] Use of STL iterators in GiNaC

Alexei Sheplyakov varg at metalica.kh.ua
Tue Apr 21 10:36:00 CEST 2009


Hi,

On Thu, Apr 16, 2009 at 01:42:23PM +0200, Jens Vollinga wrote:
> diff --git a/ginac/inifcns_nstdsums.cpp b/ginac/inifcns_nstdsums.cpp
> index 2c4061a..94fd9ce 100644
> --- a/ginac/inifcns_nstdsums.cpp
> +++ b/ginac/inifcns_nstdsums.cpp
> @@ -2455,7 +2455,8 @@ lst convert_parameter_Li_to_H(const lst& m, const lst& x, ex& pf)
>  {
>  	lst res;
>  	lst::const_iterator itm = m.begin();
> -	lst::const_iterator itx = ++x.begin();
> +	lst::const_iterator itx = x.begin();
> +	++itx;

As far as I understand both versions are completely equivalent, aren't they?

>  	int signum = 1;
>  	pf = _ex1;
>  	res.append(*itm);
> @@ -3277,7 +3278,8 @@ static ex H_eval(const ex& m_, const ex& x)
>  		pos1 = *m.begin();
>  		p = _ex1;
>  	}
> -	for (lst::const_iterator it = ++m.begin(); it != m.end(); it++) {
> +	lst::const_iterator it = m.begin();
> +	for (++it; it != m.end(); ++it) {

Same here (the iterator is incremented before testing for != end()).

Best regards,
	Alexei

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20090421/bc824089/attachment.sig>


More information about the GiNaC-list mailing list