std::ref and std::cref

In the last lesson, we were introduced to reference wrappers. Now, we will learn how to create them.

We'll cover the following...

With the helper functions std::ref and std::cref you can easily create reference wrappers to variables. std::ref will create a non constant reference wrapper, std::cref a constant one:

Access this course and 1400+ top-rated courses and projects.