monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] Re: [PATCH] monotone ls authors


From: Bruce Stephens
Subject: [Monotone-devel] Re: [PATCH] monotone ls authors
Date: Wed, 14 Dec 2005 22:02:46 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Steven E. Harris" <address@hidden> writes:

> Bruce Stephens <address@hidden> writes:
>
>> +  for (vector< revision<cert> >::const_iterator i = certs.begin();
>> +       i != certs.end(); ++i)
>
> Why keep checking against an end that doesn't change?
>
>   for (vector< revision<cert> >::const_iterator i = certs.begin(),
>                                                 end = certs.end();
>        i != end; ++i)

Well, because it was copy and paste from ls_tags.  However, I'd hope
the compiler would notice that certs isn't changing in the loop
(certs.end() is presumably const), so it wouldn't make any difference.
So it's a question of style as much as anything.  I don't care much
either way.

>> +  for (std::set< cert_value >::const_iterator i = authors.begin();
>> +       i != authors.end(); ++i)
> +    {
> +      cout << *i << endl;
> +    }
>
> How about std::copy to std::ostream_iterator?

[...]

>   std::copy( authors.begin(), authors.end(),
>              std::ostream_iterator<cret_value>( std::cout, "\n" ) );

That's definitely nicer, though.  (I prefer it, anyway.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]