mirror of
https://github.com/CnTransGroup/EffectiveModernCppChinese.git
synced 2025-01-04 09:20:39 +08:00
commit
834d6c79a0
@ -100,7 +100,7 @@ auto ep = static_cast<float>(calEpsilon());
|
|||||||
````cpp
|
````cpp
|
||||||
int index = d * c.size();
|
int index = d * c.size();
|
||||||
````
|
````
|
||||||
但是这种写法并没有明确表明你想把double类型转换成int类型,显式类型初始器可以帮助你正确表意:
|
但是这种写法并没有明确表明你想将右侧的double类型转换成int类型,显式类型初始器可以帮助你正确表意:
|
||||||
````cpp
|
````cpp
|
||||||
auto index = static_cast<int>(d * size());
|
auto index = static_cast<int>(d * size());
|
||||||
````
|
````
|
||||||
|
Loading…
Reference in New Issue
Block a user