On Mar 7, 2014, at 9:15 AM, David Blaikie <[email protected]> wrote:
> On Fri, Mar 7, 2014 at 8:58 AM, Duncan P. N. Exon Smith > <[email protected]> wrote: >> Unless the pointers themselves are changing, the only benefit here is >> consistency. But ranges of iterators should use const&, since many >> iterators are expensive to copy. > > To clarify, this isn't about copying iterators You’re right, that was a tangent. > (iterators are > generally cheap to copy) but copy the elements being iterated over. The point (of my tangent) is that some iterators (scc_iterator, po_iterator, etc.) have non-trivial state, so copies can be expensive. >> Accidental copies can be a huge headache, since they lead to subtle >> bugs that are hard to track down (performance implications aside). >> >> I still favour applying the rule generally, since consistency matters. >> But we could text like: >> >> Pointer ranges are a common exception. >> >> Any other opinions? > > If you write the exception as "auto *x" then it's unambiguous and easy > to still look at "auto x" as being questionable/to-be-avoided. This is obviously better. Changed in r203254. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
