We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http://www.cnblogs.com/ider/archive/2011/07/31/cpp_cast_operator_part4.html
static_cast
static_cast<...>(...)
reinterpret_cast
reinterpret_cast<...>(...)
The text was updated successfully, but these errors were encountered:
http://www.cnblogs.com/welfare/articles/336091.html
double
int i; double d; i = (int) d; // or i = int (d);
dynamic_cast
const_cast
Sorry, something went wrong.
No branches or pull requests
static_cast
真正用处并不在指针和引用上,而在基础类型和对象的转换上static_cast<...>(...)
跟传统转换方式几乎是一致的,所以只要将static_cast
和圆括号去掉,再将尖括号改成圆括号就变成了传统的显示转换方式。reinterpret_cast
reinterpret_cast<...>(...)
可以在任意指针之间进行互相转换,即使这些指针所指的内容是毫无关系的,也就是说一下语句,编译器是不会报错的,但是对于程序来说也是毫无意义可言的,只会造成程序崩溃The text was updated successfully, but these errors were encountered: