[llvm] r225592 - [ADT] Remove the unused default constructor for iterator_range.

Chandler Carruth chandlerc at gmail.com
Sat Jan 10 17:52:20 PST 2015


On Sat, Jan 10, 2015 at 5:16 PM, Chandler Carruth <chandlerc at gmail.com>
wrote:

> Author: chandlerc
> Date: Sat Jan 10 19:16:26 2015
> New Revision: 225592
>
> URL: http://llvm.org/viewvc/llvm-project?rev=225592&view=rev
> Log:
> [ADT] Remove the unused default constructor for iterator_range.
>
> This default constructor is a bit weird. It left the range in an invalid
> state. That might be reasonable so that you can construct a local
> iterator range and assign to it based on some logic to compute the range
> you want. If folks would like to support that use case, I can add it
> back, but in 238-odd usages none have actually wanted to do this. ;]
>

Actually, there were 3 usages in Clang.

We could value initialize the iterators in the default constructor, but
that would preclude using iterator_range with InputIterators (restricting
it to ForwardIterators and stronger). Or we could only provide the default
constructor when the iterators provide a default constructor, but that's
lots of template goop for what is otherwise super simple. And I've only
found 3 usages that were easily "fixed" to just pass the iterators
explicitly. But I wanted to mention the option here in case others feel
strongly we should make empty-range construction simple in this way.

-Chandler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150110/dc0cd235/attachment.html>


More information about the llvm-commits mailing list