Copying a non-const FunctionRef lvalue should be a trivial operation
authorEric Niebler <eniebler@fb.com>
Thu, 11 May 2017 23:55:38 +0000 (16:55 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 12 May 2017 00:06:51 +0000 (17:06 -0700)
commit6435670bdccef08dcd2713ecbed1a57caa7abfad
treede94c64f6b935f2f1a63fed51dee90a3f2f5e3fa
parent1e8e9c94da711e14dad56f944b49cf968861a6b8
Copying a non-const FunctionRef lvalue should be a trivial operation

Summary: Before this change, when a non-const FunctionRef lvalue is copied, it is treated as any other callable: it is wrapped with an indirection. That's semantically incorrect and potentially creates lifetime problems. Instead, use the compiler generated copy constructor, which only copies the object and function pointers.

Reviewed By: yfeldblum

Differential Revision: D5040843

fbshipit-source-id: f691060bdced2e287ba22d22b961c02c2b924147
folly/Function.h
folly/test/FunctionRefTest.cpp