vendredi 2 novembre 2018

How to understand 5.2.11 Const cast clause 8 in C++ standard N3337?

In C++ draft standard N3337 section 5.2.10 Const cast clause 7:

The following rules define the process known as casting away constness. In these rules Tn and Xn represent types. For two pointer types:

X1 is T1 cv1,1 * ⋯ cv1,N * where T1 is not a pointer type

X2 is T2 cv2,1 * ⋯ cv2,M * where T2 is not a pointer type

K is min (N,M)

casting from X1 to X2 casts away constness if, for a non-pointer type T there does not exist an implicit conversion (Clause conv) from:

T cv1,(N-K+1) * cv1,(N-K+2) *⋯ cv1,N *

to

T cv2,(M-K+1) * cv2,(M-K+2) *⋯ cv2,M *

I can't understand the relationship between T1,T2 and T. who can give an example?

Aucun commentaire:

Enregistrer un commentaire