[libcxx-commits] [PATCH] D121130: [libc++] Make common_iterator's proxy types into aggregates

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 7 09:25:15 PST 2022


ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

Yes, I like this better, if I understood the logic in my comment properly.



================
Comment at: libcxx/include/__iterator/common_iterator.h:123
     } else {
-      return __proxy(*_VSTD::__unchecked_get<_Iter>(__hold_));
+      return __proxy{*_VSTD::__unchecked_get<_Iter>(__hold_)};
     }
----------------
Right, so we know that `_VSTD::__unchecked_get<_Iter>(__hold_)` (aka the iterator) has a non-reference `iter_reference_t`, which is a complicated way of saying `*iter` is a temporary. So when we construct the aggregate now, we're even eliding a move operation. That sounds right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121130



More information about the libcxx-commits mailing list