[PATCH] D25124: Support rvalue references in enumerate range adapter.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 23:41:50 PDT 2016


On Fri, Sep 30, 2016 at 11:12 PM Zachary Turner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> There's already an lvalue mutation test (see context above this diff).


Doh, so there is!


> Is rvalue mutation useful? I imagine it already works, I just didn't think
> to test it because there wasn't an obvious use case
>

I think it is useful to ensure we don't get an accidental const in the
types or otherwise mess this up when stashing storage somewhere. Even if
with the current implementation we'd never write that bug, documenting that
r-value ranges should be just as mutable as l-value seems worthwhile in
unittests.


> On Fri, Sep 30, 2016 at 11:09 PM Chandler Carruth <chandlerc at gmail.com>
> wrote:
>
> chandlerc added a comment.
>
> Add a test showing mutation? Specifically that the range can be mutated
> even when a temporary is used, and that when an L-value is used the
> mutation mutates the underlying object rather than a copy (either of the
> element or the container).
>
>
>
> > STLExtrasTest.cpp:169
> > +  Copies = Moves = Destructors = 0;
> > +  // With an lvalue, it should not be destroyed even after the end of
> the scope.
> > +  // lvalue ranges need be neither copyable nor moveable.
>
> 80-columns?
>
> https://reviews.llvm.org/D25124
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161001/fc735b0e/attachment.html>


More information about the llvm-commits mailing list