[libcxx-commits] [PATCH] D112368: [libc++][format] Move iterators when needed.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Oct 24 03:08:15 PDT 2021


Mordante added a comment.

I spend some time implementing tests but see some other issues, which I want to investigate before proceeding with this patch.



================
Comment at: libcxx/include/__format/format_context.h:96
 #endif
-  _LIBCPP_HIDE_FROM_ABI iterator out() { return __out_it_; }
-  _LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = __it; }
+  _LIBCPP_HIDE_FROM_ABI iterator out() { return _VSTD::move(__out_it_); }
+  _LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = _VSTD::move(__it); }
----------------
Mordante wrote:
> Quuxplusone wrote:
> > This is correct per the Standard, but also kinda crazy, in that `y = x.out()` modifies the value of `x`. It should have been specified with an rvalue-ref-qualifier, like `out() &&`, right?
> > No action required, anyway, since this PR implements what the Standard says to do. Just kibitzing.
> I agree, this feels odd. But it's what the Standard mandates. I'm tempted to file an LWG-issue.
I've decided to file an LWG-issue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112368/new/

https://reviews.llvm.org/D112368



More information about the libcxx-commits mailing list