[libcxx-commits] [PATCH] D62928: Constrain function assignment operator (2574)

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 5 14:41:03 PDT 2019


ldionne added inline comments.


================
Comment at: include/functional:2231
     function& operator=(nullptr_t) _NOEXCEPT;
-    template<class _Fp, class = _EnableIfCallable<_Fp>>
+    template<class _Fp, class = _EnableIfCallable<typename decay<_Fp>::type&>>
     function& operator=(_Fp&&);
----------------
zoecarver wrote:
> ldionne wrote:
> > I think this should just be `_EnableIfCallable<typename decay<_Fp>::type>`, since we already add the reference inside `__callable` above.
> > 
> > Alternatively, I think it would be even better to NOT add the reference inside `__callable`, and instead do it when we call `_EnableIfCallable`.
> Good catch. I will remove the reference here. If you think it would be better, I can make another patch to update all instances of `_EnableIfCallable`.
I would update this patch as suggested.


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D62928





More information about the libcxx-commits mailing list