[webkit-dev] Should we ever use std::function instead of WTF::Function?

Chris Dumez cdumez at apple.com
Tue Jun 13 09:26:25 PDT 2017


The only advantage of std::function that I know of is that it is copyable. Unless you really need to copy your lambda for a reason or another, I don’t see a good reason to ever use std::function instead of WTF::Function.

I have been slowly replacing std::function by WTF::Function in the code base but there are still a lot of uses of std::function.

--
 Chris Dumez




> On Jun 13, 2017, at 9:24 AM, Darin Adler <darin at apple.com> wrote:
> 
> I’ve noticed many patches switching us from std::function to WTF::Function recently, to fix problems with copying and thread safety.
> 
> Does std::function have any advantages over WTF::Function? Should we ever prefer std::function, or should we use WTF::Function everywhere in WebKit where we would otherwise use std::function?
> 
> — Darin
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20170613/6096f6f7/attachment.html>


More information about the webkit-dev mailing list