Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Does cv-qualified Mean? [duplicate]

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?

like image 714
Jonathan Mee Avatar asked Dec 17 '14 14:12

Jonathan Mee


2 Answers

c-v qualified means const and volatile...For e.g:-

// non cv_qualified 
int first; 
char *second; 

// cv-qualified 
const int third; 
volatile char * fourth; 
like image 78
ravi Avatar answered Sep 20 '22 21:09

ravi


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.

like image 40
Vlad from Moscow Avatar answered Sep 21 '22 21:09

Vlad from Moscow