static_cast operator

   
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

   


C++ in a Nutshell
C++ in a Nutshell
ISBN: 059600298X
EAN: 2147483647
Year: 2005
Pages: 270
Authors: Ray Lischner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net