[cfe-dev] C++11 reverse iterators (was C++11 is here)

Chris Lattner sabre at nondot.org
Mon Mar 3 09:48:04 PST 2014


On Mar 3, 2014, at 12:04 AM, Chandler Carruth <chandlerc at google.com> wrote:
>> I was actually going to check in this, but I can post it for review if folks are worried.
>> 
>> My plan was to provide an implementation of std::iterator_range<T> and then provide 'F.arguments()' which returns it.
> 
> Nice.  What's the logic behind .arguments() vs .getArguments()?  I don't have a strong opinion either way, but there should be rationale.
> 
> In the best case 'get' doesn't really add any meaning, and in the worst case it is actively misleading

It's getting the range though, just like Function::getArgumentList() returns the argument list.

> For example, you might iterate over operands, and assign through the iterator to mutate them.
> 
> Really, these operate as range-views over some sequence. It seems particularly easy to teach foo_begin(), foo_end() -> foos() as well.

That's a very objective-c thing to do :-), they use the pattern foo() and setFoo() for the getter and setter, respectively (and the naming is baked into the property model).  I don't feel strongly against it, but we pretty consistently use the Java style 'get' prefix everywhere else.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140303/2f17c2b9/attachment.html>


More information about the cfe-dev mailing list