R1 recently enhanced the standard header <utility>
with a small reference wrapping library that includes the class template reference_wrapper
and the helper functions ref()
. This mini-library library solves the onerous problem of argument forwarding. In addition, it enables you to simulate containers of references. The following sections explain how to do that.
How do you pass references as arguments to algorithms? How do you create containers of references?
Use reference_wrapper and its associated helper functions ref() and cref().