|
|
|
|
|
by phoe-krk
2209 days ago
|
|
C++17 is capable of multiple variable declaration, which is a similar concept. #include <tuple>
#include <iostream>
std::tuple<int, int> divide(int dividend, int divisor) {
return {dividend / divisor, dividend % divisor};
}
int main() {
using namespace std;
auto [quotient, remainder] = divide(14, 3);
cout << quotient << ',' << remainder << endl;
}
|
|
This shows the kind of (imho) "ugly hacks" the C++ committee had to make to cover up the historical mistake with the comma operator.