On Sunday, February 25, 2024, Frederick Virchanza Gotham wrote:
If you absolutely must create a variable of class type that might throw, then use std::optional:
{ _Bulldoze:
optional<stringstream> ss;
if ( ss ) *ss << 77;
if ( ss ) cout << std::move(*ss).str();
}
I forgot the 'emplace':
{ _Bulldoze:
optional<stringstream> ss;
ss.emplace();
if ( ss ) *ss << 77;
if ( ss ) cout << std::move(*ss).str();
}