[PATCH] D50106: [libc++] Fix tuple assignment from types derived from a tuple-like

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 19 14:45:10 PST 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/include/tuple:971
+        _VSTD::get<0>(*this) = _VSTD::forward<_Up1>(__pair.first);
+        _VSTD::get<1>(*this) = _VSTD::forward<_Up2>(__pair.second);
+        return *this;
----------------
Oh, late-breaking nit: I would prefer to see `... = static_cast<_Up1&&>(__pair.first);` here, because `_Up1` is not being deduced according to forwarding-reference rules, and thus shouldn't be "forwarded."  Pragmatically I think `forward<_Up1>` ends up doing the right thing in all cases... but I don't think it's appropriate here. (Plus, we save one function template instantiation by omitting it!)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D50106



More information about the cfe-commits mailing list