proxygen
|
Create a folly::rvalue_reference_wrapper. Analogous to std::ref().
Warning: folly::rvalue_reference_wrappers are potentially dangerous, because they can easily be used to capture references to temporary values. Users must ensure that the target object outlives the reference wrapper.
class Object {}; void f(Object&&); // BAD void g() { auto ref = folly::rref(Object{}); // create reference to temporary f(std::move(ref)); // pass dangling reference } // GOOD void h() { Object o; auto ref = folly::rref(std::move(o)); f(std::move(ref)); }