[libcxx-commits] [PATCH] D107932: [libc++] Do not require movability in __non_propagating_cache::__emplace_deref

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 11 14:15:26 PDT 2021


ldionne created this revision.
ldionne added reviewers: tcanens, zoecarver.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

As explained in http://eel.is/c++draft/range.nonprop.cache#note-1, we
should allow copy and move elision to happen when calling emplace_deref
in non-propagating-cache. Before this change, the only way to emplace
into the non-propagating-cache was to call `__set(*it)`, which materialized
`*it` when binding it to the reference argument of `__set` and disabled
move elision.

As a fly-by change, this also renames `__set` to `__emplace` for consistency
and adds tests for it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107932

Files:
  libcxx/include/__ranges/drop_view.h
  libcxx/include/__ranges/non_propagating_cache.h
  libcxx/include/__ranges/reverse_view.h
  libcxx/test/libcxx/ranges/range.nonprop.cache/assign.copy.pass.cpp
  libcxx/test/libcxx/ranges/range.nonprop.cache/assign.move.pass.cpp
  libcxx/test/libcxx/ranges/range.nonprop.cache/ctor.copy.pass.cpp
  libcxx/test/libcxx/ranges/range.nonprop.cache/ctor.move.pass.cpp
  libcxx/test/libcxx/ranges/range.nonprop.cache/deref.pass.cpp
  libcxx/test/libcxx/ranges/range.nonprop.cache/emplace.pass.cpp
  libcxx/test/libcxx/ranges/range.nonprop.cache/emplace_deref.pass.cpp
  libcxx/test/libcxx/ranges/range.nonprop.cache/has_value.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107932.365851.patch
Type: text/x-patch
Size: 12968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210811/b61d7d05/attachment-0001.bin>


More information about the libcxx-commits mailing list