[cfe-commits] [patch] TransformIterator (motivating use case in Clang)

David Blaikie dblaikie at gmail.com
Sun May 27 22:29:16 PDT 2012


> "I.foo" vs. "I->foo" doesn't matter much to me, but "(*I)->foo" and "&*I" are really, really ugly.

I meant to mention on this point - I offered a patch that would've
removed much of the "&*I" usage, since many clients were tidier using
*I and references rather than pointers anyway.

> It makes sense to factor out the filtering-iterator functionality, but I'd rather not have to restyle the code base to do it.

Right, certainly it's not necessary - I was just trying to tidy up
something that looked rather confusing (a half-pointer/half-value
iterator).

In any case, as the prevailing opinion seems to be pointers, here's a
patch that switches everything back to pointers. I've left the
reference and pointer typedefs as void rather than as either
inconsistent (as they were before) or complex (proxy objects). I
couldn't omit the typedefs entirely as some operations (std::distance)
seem to require their presence. They can be fixed/filled in when
necessary.

I'll check this in & then set about making the relevant
filtering/adapting iterators in such a way that they can handle these
iterators, including voiding the reference/pointer typedefs when
convenient, and adding -> when the value type is T*.

(oh, and apologies to out-of-tree code that gets broken again by this
change back from value to pointer semantics)

Thanks,
- David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iterators.diff
Type: application/octet-stream
Size: 94495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120527/18fd8b71/attachment.obj>


More information about the cfe-commits mailing list