[cfe-users] C++ lambdas more expensive than blocks?

Benjamin Kramer via cfe-users cfe-users at lists.llvm.org
Tue Oct 25 01:13:38 PDT 2016


Copying function_ref will work, it's independent of the rest of LLVM
and works with all C++11 compilers. I also expect common C++ libraries
to have an equivalent class, but I haven't checked.

On Tue, Oct 25, 2016 at 3:33 AM, Jens Alfke <jens at mooseyard.com> wrote:
>
> On Oct 24, 2016, at 12:00 PM, Benjamin Kramer <benny.kra at gmail.com> wrote:
>
> a helper class such as llvm::function_ref[1] might come
> in handy, which acts like a function pointer but also allows captures
> to be passed around.
>
>
> Thanks. Is that class something I can just copy-and-paste into my code? Will
> it work with other compilers like GCC or MSVC?
> (Sorry if these are naive questions; I’m not knowledgeable enough about
> templates to be able to understand that source code.)
>
> —Jens



More information about the cfe-users mailing list