Is it possible to use structured bindings to assign class members?
I'd like to use C++ 17 structured bindings to assign a value to a class member variable, like this: #include <cmath> #include <iostream> struct Result { double value; bool error; }; Result square_root(double input) { return {std::sqrt(input), input < 0}; } struct Calculator { double result_; bool error_; public: void ComputeSquareRoot(double input) { [ result_, error_ ] = square_root(input); } void DisplayResult() { if (error_) std::cout << "Cannot take the square root of a negative number.\n"; else std::cout << "The square root is " << result_ << ".\n"; } }; int main(int argc, char* argv[]) {