ML-style Tuple Assignment in Standard C++ -Extending the Multiple Return Value Formalism
Jaakko Järvi · 1999
It has been shown previously that tuples can be implemented with templates in standard C++. This article extends the author's previous work on tuples and multiple return values by defining generic functions and classes to support a kind of a multivalued assignment. The return values of a function returning a tuple can be assigned to separate variables with a single statement. E.g., assuming that foo is a function returning a 3-tuple and that a, b and c are variables of correct type, the expression tie(a, b, c) = foo() assigns the three returned elements to a, b and c.