由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - const_cast问题
相关主题
有关objec access path的问题为什么cpp会有 const_cast ?
C++ cast 小结conversion between const to nonconst
how to change a variable's value in a const function关于const_cast,地址一样,值不同?
reinterpret cast的问题师傅们:C里边有没有类似const_cast的玩意?
C++ 的 问题what's the meaning of const_cast
有段c++代码看不懂一个诡异的const_cast问题
一个const_cast问题c++ cast problem
看道c++题: brianbench[合集] 问两个C++面试题目, 请指点, 谢谢 (转载)
相关话题的讨论汇总
话题: const话题: constness话题: object话题: casting话题: originally
进入Programming版参与讨论
1 (共1页)
j*****k
发帖数: 1198
1
effective c++里面说:
In particular, if the object this points to is truly const, i.e., was
declared const at its point of definition, the results of casting away its
constness are undefined. If you want to cast away constness in one of your
member functions, you'd best be sure that the object you're doing the
casting on wasn't originally defined to be const.
这儿是不是指如果the object is originally defined to be a const, the casted
result can not be used as lvalue? 如果是这样的话,下面就可以理解了。如果不是
,那是什么意思呢?
size_t st
d*****a
发帖数: 110
2
//ft, it makes me dizzy to see the mix-up of c char* and c++ string...
1 (共1页)
进入Programming版参与讨论
相关主题
[合集] 问两个C++面试题目, 请指点, 谢谢 (转载)C++ 的 问题
问题: C++ static_cast between int and float有段c++代码看不懂
question about const reference一个const_cast问题
[合集] static const代替define的performance tradeoff在哪里?看道c++题: brianbench
有关objec access path的问题为什么cpp会有 const_cast ?
C++ cast 小结conversion between const to nonconst
how to change a variable's value in a const function关于const_cast,地址一样,值不同?
reinterpret cast的问题师傅们:C里边有没有类似const_cast的玩意?
相关话题的讨论汇总
话题: const话题: constness话题: object话题: casting话题: originally