Daily bit(e) of C++ | std::reference_wrapper, std::ref, std::cref
The std::reference_wrapper is a simple indirection wrapper that can implicitly convert to the wrapped type.
std::reference_wrapper has special interactions with std::make_pair and std::make_tuple (where the type is deduced as T&) and can force reference semantics for APIs where the default behaviour involves a copy.
ncG1vNJzZmirmaK8r8DOrZ9nq6WXwLWtwqRlnKedZL1wsMCio7Jlkp7BpnnOn2ScZaOpsbOxxZ6pnqaTmqy4vsCpp56q
Filiberto Hargett
Update: 2024-12-02