Search code examples
c++storage-duration

Reference type and storage duration


First, I quote the definition of storage duration (sec. 3.7.1/1 N3797):

Storage duration is the property of an object that defines the minimum potential lifetime of the storage containing the object.

But 3.7.1/3 said:

The storage duration categories apply to references as well.

It is curious. I thought reference has no representation in memory at all. I also thought an objects and only objects represents in memory (sec. 1.8/1):

An object is a region of storage.

What is the point of introducing storage duration concept to a reference?


Solution

  • From §8.3.2/4:

    It is unspecified whether or not a reference requires storage.

    So if a reference does require some storage, the lifetime of that storage corresponds to the reference's storage duration.