The struct template std::pair can bundle together exactly two return values, of any two types:
#include <utility>
std::pair<int, int> foo(int a, int b) {
return std::make_pair(a+b, a-b);
}
With C++11 or later, an initializer list can be used instead of std::make_pair:
C++11
...