You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
小彭老师好,《现代C++入门:RAII内存管理》一课中提到的:初始化列表妙用,解决函数多返回值,更加fancy的写法无法编译通过。
示例代码:
struct {
bool b1;
double d1;
} test_anoy() {
return {false, 1.0};
}
编译错误:
test.cpp:9:1: error: new types may not be defined in a return type
9 | struct {
| ^~~~~~
test.cpp:9:1: note: (perhaps a semicolon is missing after the definition of ‘’)
The text was updated successfully, but these errors were encountered:
小彭老师好,《现代C++入门:RAII内存管理》一课中提到的:初始化列表妙用,解决函数多返回值,更加fancy的写法无法编译通过。
示例代码:
struct {
bool b1;
double d1;
} test_anoy() {
return {false, 1.0};
}
编译错误:
test.cpp:9:1: error: new types may not be defined in a return type
9 | struct {
| ^~~~~~
test.cpp:9:1: note: (perhaps a semicolon is missing after the definition of ‘’)
The text was updated successfully, but these errors were encountered: