<div dir="ltr">Yeah, wouldn't worry about it much - as you say, consistency with existing code, etc. *shrug*</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 1, 2016 at 2:22 AM, Filipe Cabecinhas <span dir="ltr"><<a href="mailto:me@filcab.net" target="_blank">me@filcab.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Honestly, I didn't think too much about it and just did the same as<br>
const_iterator.<br>
As for having the operator as a non-instance variable, it wouldn't<br>
bring us anything new yet:<br>
The only definition is for (reverse_iterator - reverse_iterator), and<br>
afaict, there's no implicit conversion from anything to that.<br>
<br>
If you still want those changes or want me to still bring it to an<br>
inline definition, let me know. Not sure if we'll be saving much, but<br>
it won't hurt :-)<br>
<br>
Thank you,<br>
<br>
  Filipe<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Apr 29, 2016 at 11:55 PM, David Blaikie via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Usually member variables that can be non-instance members should be<br>
> non-instance members so as to allow equal conversions on the left and right<br>
> hand operands. One way to do this is to declare it as a friend, instead of<br>
> as a non-static member (or even define it in terms of another operation)<br>
><br>
> Also not sure whether that operation should be out of line, or just make it<br>
> inline?<br>
><br>
> On Fri, Apr 29, 2016 at 9:48 AM, Filipe Cabecinhas via llvm-commits<br>
> <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
>><br>
>> Author: filcab<br>
>> Date: Fri Apr 29 11:48:07 2016<br>
>> New Revision: 268062<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=268062&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=268062&view=rev</a><br>
>> Log:<br>
>> Add operator- to Path's reverse_iterator. Needed for D19666<br>
>><br>
>> Reviewers: rafael, craig.topper, bogner<br>
>><br>
>> Subscribers: llvm-commits<br>
>><br>
>> Differential Revision: <a href="http://reviews.llvm.org/D19724" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19724</a><br>
>><br>
>> Modified:<br>
>>     llvm/trunk/include/llvm/Support/Path.h<br>
>>     llvm/trunk/lib/Support/Path.cpp<br>
>><br>
>> Modified: llvm/trunk/include/llvm/Support/Path.h<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Path.h?rev=268062&r1=268061&r2=268062&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Path.h?rev=268062&r1=268061&r2=268062&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/Support/Path.h (original)<br>
>> +++ llvm/trunk/include/llvm/Support/Path.h Fri Apr 29 11:48:07 2016<br>
>> @@ -87,6 +87,9 @@ public:<br>
>>    reverse_iterator &operator++();    // preincrement<br>
>>    bool operator==(const reverse_iterator &RHS) const;<br>
>>    bool operator!=(const reverse_iterator &RHS) const { return !(*this ==<br>
>> RHS); }<br>
>> +<br>
>> +  /// @brief Difference in bytes between this and RHS.<br>
>> +  ptrdiff_t operator-(const reverse_iterator &RHS) const;<br>
>>  };<br>
>><br>
>>  /// @brief Get begin iterator over \a path.<br>
>><br>
>> Modified: llvm/trunk/lib/Support/Path.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Path.cpp?rev=268062&r1=268061&r2=268062&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Path.cpp?rev=268062&r1=268061&r2=268062&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Support/Path.cpp (original)<br>
>> +++ llvm/trunk/lib/Support/Path.cpp Fri Apr 29 11:48:07 2016<br>
>> @@ -353,6 +353,10 @@ bool reverse_iterator::operator==(const<br>
>>           Position == RHS.Position;<br>
>>  }<br>
>><br>
>> +ptrdiff_t reverse_iterator::operator-(const reverse_iterator &RHS) const<br>
>> {<br>
>> +  return Position - RHS.Position;<br>
>> +}<br>
>> +<br>
>>  StringRef root_path(StringRef path) {<br>
>>    const_iterator b = begin(path),<br>
>>                   pos = b,<br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
><br>
</div></div></blockquote></div><br></div>