Seastar
High performance C++ framework for concurrent servers
|
Wrapper for lvalue references
reference_wrapper wraps a lvalue reference into a copyable and assignable object. It is very similar to std::reference_wrapper except that it doesn't allow implicit construction from a reference and the only way to construct it is to use either ref() or cref(). The reason for that discrepancy (and also the reason why seastar::reference_wrapper was introduced) is that it serves a different purpose than std::reference_wrapper. The latter protects references from decaying and allows copying and assigning them. seastar::reference_wrapper is used mainly to force the user to explicitly state that an object is passed by reference thus reducing the chances of the referred object being prematurely destroyed in case the execution is deferred to a continuation.
#include <seastar/util/reference_wrapper.hh>
Public Types | |
using | type = T |
Public Member Functions | |
operator T& () const noexcept | |
T & | get () const noexcept |