mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
5e0b5ff7cc
Summary: `SharedFunction` implements a pattern of a shared callable object that contains the same executable inside. It's similar to `std::function` with one important difference: when the object is copied, the stored function (and captured values) are shared between instances (not copied). `SharedFunction` can be stored inside `std::function` because it's callable. It useful in some scenarios, such as: * When captured by `std::function` arguments are not copyable; * When we need to replace the content of the callable later on the go. We will use it in the coming diffs. Reviewed By: mdvacca Differential Revision: D14072078 fbshipit-source-id: 9df4ad2d1b92394e2dfef5c283f35c7c0bd4b500