static_cast operator |
Explicit cast operator
|
postfix-expr := static_cast < type-id > ( expression )
|
|
The static_cast operator performs type conversions
from one static type to another. It cannot cast away
const or volatile qualifiers. A
static cast can invoke built-in type promotions or conversions or
user-defined type conversions with type conversion operators or
constructors (including explicit constructors).
Example
char c;
if (isalpha(static_cast<unsigned char>(c))
handle_alpha(c);
See Also
const_cast, dynamic_cast,
explicit, expression,
reinterpret_cast, Chapter 3
|