[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] Re: [PATCH] monotone ls authors
From: |
Nathaniel Smith |
Subject: |
Re: [Monotone-devel] Re: [PATCH] monotone ls authors |
Date: |
Wed, 14 Dec 2005 14:08:32 -0800 |
User-agent: |
Mutt/1.5.9i |
On Wed, Dec 14, 2005 at 10:16:35AM -0800, Steven E. Harris wrote:
> 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)
Ack, don't do this! It's completely against the idiom, uglifies the
code, and does _not_ improve performance. (end() is inlined anyway!)
> > + 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?
>
> #include <algorithm>
> #include <iterator>
>
> std::copy( authors.begin(), authors.end(),
> std::ostream_iterator<cret_value>( std::cout, "\n" ) );
It's an option. The two seem pretty similar to me, I certainly
wouldn't reject a patch for using the former style.
-- Nathaniel
--
"On arrival in my ward I was immediately served with lunch. `This is
what you ordered yesterday.' I pointed out that I had just arrived,
only to be told: `This is what your bed ordered.'"
-- Letter to the Editor, The Times, September 2000
- [Monotone-devel] [PATCH] monotone ls authors, Bruce Stephens, 2005/12/14
- [Monotone-devel] Re: [PATCH] monotone ls authors, Bruce Stephens, 2005/12/14
- [Monotone-devel] Re: [PATCH] monotone ls authors, Bruce Stephens, 2005/12/14
- [Monotone-devel] Re: [PATCH] monotone ls authors, Steven E. Harris, 2005/12/14
- [Monotone-devel] Re: [PATCH] monotone ls authors, Bruce Stephens, 2005/12/14
- Re: [Monotone-devel] Re: [PATCH] monotone ls authors,
Nathaniel Smith <=
- [Monotone-devel] Re: [PATCH] monotone ls authors, Bruce Stephens, 2005/12/15
- [Monotone-devel] Re: [PATCH] monotone ls authors, Steven E. Harris, 2005/12/15
- [Monotone-devel] Re: [PATCH] monotone ls authors, Bruce Stephens, 2005/12/15
- Re: [Monotone-devel] Re: [PATCH] monotone ls authors, Nathaniel Smith, 2005/12/15
- [Monotone-devel] Re: [PATCH] monotone ls authors, Steven E. Harris, 2005/12/15