Search code examples
c++declarationdefinitionqualifiers

What Does cv-qualified Mean?


I have started seeing the term "cv-qualified" being thrown around a lot.

An answer to my last question:

if T is a (possibly cv-qualified) class type (Clause 9), the default constructor (12.1) for T is called

Can someone define that for me?


Solution

  • c in cv means const and v means volatile.

    From the C++ Standard (3.9.3 CV-qualifiers)

    • The term object type (1.8) includes the cv-qualifiers specified in the decl-specifier-seq (7.1), declarator (Clause 8), type-id (8.1), or newtype - id (5.3.4) when the object is created.

    • A const object is an object of type const T or a non-mutable subobject of such an object.

    • A volatile object is an object of type volatile T, a subobject of such an object, or a mutable subobject of a const volatile object.

    • A const volatile object is an object of type const volatile T, a non-mutable subobject of such an object, a const subobject of a volatile object, or a non-mutable volatile subobject of a const object.