I have a function xyz() which returns an tuple<std::string, double>.
When I call this function individually, I can do the following:
auto [tresh, loss] = xyz(i);
This results in no error, but if I want to use the xyz() function in an if else block, then I can not use the tresh and loss variables anymore in the following code. Example:
if (boolX) {
auto [tresh, loss] = xyz(i);
} else {
auto [tresh, loss] = xyz(j);
}
std::cout << tresh << std::endl;
I also tried to initialise the tresh and loss variable before the if else block and remove the auto, but this gives the following error:
Expected body of lambda expression
How to resolve this?