Motivation behind reference_wrapper and common use cases.
std::ref and std::reference_wrapper: Common use cases
by Hitesh Kumar
From this article:
An std::reference_wrapper is a copyable and assignable object that emulates a reference. Contrary to its name, it does not wrap a reference. It works by encapsulating a pointer (T*) and by implicitly converting to a reference (T&). It cannot be default constructed or initialized with a temporary; therefore, it cannot be null or invalid.
Add a Comment
Comments are closed.