reference_wrapper(3) reference_wrapper(3)

NAME

reference_wrapper - reference container

SYNOPSIS

#include <cfl/containers/reference_wrapper.hpp>

int i {0};

// reference_wrapper_c <int &>
auto && u = reference_wrapper (i);

// int
auto && v = reference_wrapper (0);

DESCRIPTION

Puts values of reference type into a container, which then can be used to reseat references. A non-reference type argument is a no-op.

The inner value is retreived with the get access function. However, the reference_wrapper_c container is also implicitly constructible from its element type, and implicitly convertible back again. This requires some caution from the user.

reference_wrapper is mainly intended for library implementation details and not for the end user.