Returning multiple values from a C++ function

For returning two values I use a std::pair (usually typedef’d). You should look at boost::tuple (in C++11 and newer, there’s std::tuple) for more than two return results.

With introduction of structured binding in C++ 17, returning std::tuple should probably become accepted standard.

Leave a Comment