4 ms·
auto [error, value] = do_something() if(!error) process(value) Is there something wrong with this?
by BoorishBears 5y ago
auto [error, value] = do_something()
if(!error)
process(value)
Is there something wrong with this?
- kaashif 5y agoHmm, is it error, value or value, error? In this situation, I'd prefer something like std::optional or std::variant, which you can't get wrong as easily as swapping two variables in a structured bind. Those have their problems too, though, and I'd never claim std::variant is "nice" to use.