return {}; in c++
return {}; 的基本语法意义
- it returns a default-constructed instance of the function’s return type.
- Or it is simple
return;
without value? - No, as the discussion reveals, it is a compile-time error if your function should return something (i.e. not of void return type) and you write just
return;
On the other handreturn{};
is valid if you have a return type.