|
const_cast Operator
Grammar
postfix-expression:
const_cast < type-id > ( expression )
The const_cast operator can be used to remove the const, volatile, and __unaligned attribute(s) from a class.
A pointer to any object type or a pointer to a data member can be explicitly converted to a type that is identical except for the const, volatile, and __unaligned qualifiers. For pointers and references, the result will refer to the original object. For pointers to data members, the result will refer to the same member as the original (uncast) pointer to data member. Depending on the type of the referenced object, a write operation through the resulting pointer, reference, or pointer to data member might produce undefined behavior.
You cannot use the const_cast operator to directly override a constant variable's constant status.
The const_cast operator converts a null pointer value to the null pointer value of the destination type.
以上是从MSDN网站上复制下来的.
根据其使用方式,个人认为,完全有理由把它们看成是(模板)函数. |
|