A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://timsong-cpp.github.io/cppwp/n4140/conv.qual below:

[conv.qual]

A prvalue of type “pointer to cv1 T” can be converted to a prvalue of type “pointer to cv2 T” if “cv2 T” is more cv-qualified than “cv1 T”.

A prvalue of type “pointer to member of X of type cv1 T” can be converted to a prvalue of type “pointer to member of X of type cv2 T” if “cv2 T” is more cv-qualified than “cv1 T”.

Note: Function types (including those used in pointer to member function types) are never cv-qualified ([dcl.fct]).  — end note ]

A conversion can add cv-qualifiers at levels other than the first in multi-level pointers, subject to the following rules:58

Two pointer types T1 and T2 are similar if there exists a type T and integer n > 0 such that:

T1

is

cv1,0

pointer to

cv1,1

pointer to

cv1,n-1

pointer to

cv1,n T

and

T2

is

cv2,0

pointer to

cv2,1

pointer to

cv2,n-1

pointer to

cv2,n T

where each cvi,j is const, volatile, const volatile, or nothing. The n-tuple of cv-qualifiers after the first in a pointer type, e.g., cv1,1, cv1,2, , cv1,n in the pointer type T1, is called the cv-qualification signature of the pointer type. An expression of type T1 can be converted to type T2 if and only if the following conditions are satisfied:

Note: if a program could assign a pointer of type T** to a pointer of type const T** (that is, if line #1 below were allowed), a program could inadvertently modify a const object (as it is done on line #2). For example,

int main() {
  const char c = 'c';
  char* pc;
  const char** pcc = &pc;         *pcc = &c;
  *pc = 'C';                    }

 — end note ]

A multi-level pointer to member type, or a multi-level mixed pointer and pointer to member type has the form:

cv0 P0

to

cv1P1

to

cvn-1Pn-1

to

cvn T

where Pi is either a pointer or pointer to member and where T is not a pointer type or pointer to member type.

Two multi-level pointer to member types or two multi-level mixed pointer and pointer to member types T1 and T2 are similar if there exists a type T and integer n > 0 such that:

T1

is

cv1,0P0

to

cv1,1P1

to

cv1,n-1Pn-1

to

cv1,n T

and

T2

is

cv2,0P0

to

cv2,1P1

to

cv2,n-1Pn-1

to

cv2,n T

For similar multi-level pointer to member types and similar multi-level mixed pointer and pointer to member types, the rules for adding cv-qualifiers are the same as those used for similar pointer types.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4