Explicit C++ describes how to use std::reference_wrapper
to create alternative views of data.
Tippet: Use reference_wrapper to create views of data
by Indi
from the article:
When working with objects indirectly, always use references. Only use pointers to indicate optional referencing. But there’s one little hitch: because you can’t rebind references, you can’t simply have a container of references. Enter
std::reference_wrapper
.
Add a Comment
Comments are closed.