aaron.ballman added inline comments.

================
Comment at: clang-tidy/modernize/ReplaceGenericFunctorCallCheck.cpp:27-32
+  // template<class T>
+  // void f(T func) {
+  //   func();
+  //   ^~~~~~~
+  //   ::std::invoke(func, 1)
+  Finder->addMatcher(callExpr(has(declRefExpr())).bind("functor"), this);
----------------
lebedev.ri wrote:
> aaron.ballman wrote:
> > lebedev.ri wrote:
> > > Bikeshedding: i do not understand the idea behind `std::invoke`.
> > > Why is the new version better/preferred?
> > It generically handles all the various kinds of "callable" objects 
> > (lambdas, functors, function pointers, pointer to member functions, etc).
> Thank you for answering, but i still do not understand.
> E.g. on that example, what benefits does it give?
> Even after looking at cppreference, i'm not sure..
> Just curious.
Genericity is the primary benefit. Here's the original paper with its 
motivation:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3727.html


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52281



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to