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

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 1 09:34:27 PDT 2016


On Fri, Sep 30, 2016 at 11:42 PM Chandler Carruth <chandlerc at gmail.com>
wrote:

> 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.
>

So at least with my current implementation I can't modify the Value when
creating an enumerator from an rvalue-reference.  I'll have to dig into
this to figure out what the problem is, but it looks like when I declare
the class member:

`R Range;`

R is of type `const std::vector<int>`.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161001/e6a6aa1e/attachment.html>


More information about the llvm-commits mailing list