[PATCH] D38627: [clangd] Added move-only function helpers.
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 9 06:49:14 PDT 2017
ilya-biryukov added inline comments.
Comment at: clangd/Function.h:36
+ template <class Callable>
+ UniqueFunction(Callable Func)
+ : CallablePtr(llvm::make_unique<
> Do you want this constructor to be explicit?
> If not, I think you should be able to simplify the callsites in ClangdServer.h
Thanks for spotting this.
I think implicit works fine here. `std::function` also has implicit constructors. Simplified the callsites.
Comment at: clangd/Function.h:117
+/// Creates an object that stores a callable (\p F) and first arguments to the
+/// callable (\p As) and allows to call \p F with \Args at a later point.
> I find these "first arg" APIs a bit awkward, and can lead to writing confusing APIs for easier binding. Not sure there's a good alternative, though.
Yeah. Works just like `std::bind`, though. And I would be very happy to remove that particular function altogether when we'll be able to use lambda initializer in LLVM codebase.
More information about the cfe-commits