File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ decltype(x+y) z;
375
375
if (std::is_same<decltype(x), int>::value)
376
376
std::cout << "type x == int" << std::endl;
377
377
if (std::is_same<decltype(x), float>::value)
378
- std::cout << "type z == float" << std::endl;
378
+ std::cout << "type x == float" << std::endl;
379
379
if (std::is_same<decltype(x), decltype(z)>::value)
380
380
std::cout << "type z == type x" << std::endl;
381
381
```
@@ -389,7 +389,7 @@ type z == type x
389
389
390
390
### 尾返回类型推导
391
391
392
- 你可能会思考,在介绍 ` auto ` 时,我们已经提过类型推导不能用于函数形参,那么` auto ` 能不能用于推导函数的返回类型呢?还是考虑一个加法函数的例子,在传统 C++ 中我们必须这么写:
392
+ 你可能会思考,在介绍 ` auto ` 时,我们已经提过类型推导不能用于函数形参,那么 ` auto ` 能不能用于推导函数的返回类型呢?还是考虑一个加法函数的例子,在传统 C++ 中我们必须这么写:
393
393
394
394
``` cpp
395
395
template <typename R, typename T, typename U>
You can’t perform that action at this time.
0 commit comments