Details
- Reviewers
ldionne - Group Reviewers
Restricted Project - Commits
- rG844a9c0ef454: [libc++] Make common_iterator's proxy types into aggregates.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Yes, I like this better, if I understood the logic in my comment properly.
libcxx/include/__iterator/common_iterator.h | ||
---|---|---|
123 | 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? |
libcxx/include/__iterator/common_iterator.h | ||
---|---|---|
123 | We're replacing a conversion iter_reference_t&& -> iter_value_t with a conversion iter_reference_t -> iter_value_t. In the case that iter_reference_t and iter_value_t are the same type, this is a savings. Otherwise, AIUI, it's really no different. (But I imagine that "they're the same type" is the common case.) Also in the __postfix_proxy case, we're replacing iter_reference_t&& -> iter_reference_t with iter_reference_t -> iter_reference_t, which definitely saves one move-ctor of whatever type iter_reference_t is. |
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?