You could write a simple struct that holds the variables and return it, or use an std::pair or std::tuple:
#include
std::pair foo()
{
return std::make_pair(42., 3.14);
}
#include
#include // C++11, for std::tie
int main()
{
std::pair p = foo();
std::cout << p.first << ", " << p.second << std::endl;
// C++11: use std::tie to unpack into pre-existing variables
double x, y;
std::tie(x,y) = foo();
std::cout << x << ", " << y << std::endl;
// C++17: structured bindings
auto [xx, yy] = foo(); // xx, yy are double
}