You can keep your
tuple
as it is.
std::tuple<string, string> GetEmployee();
C++17 has structured binding which allows for returning multiple values from
std::pair
or
std::tuple
.
How to return multiple values from a function in C++17[
^]
You can define the returned variables in this way when calling
GetEmployee()
auto [name, jobTitle] = GetEmployee();
To use structured binding in Visual C++ 2019, you have to set the language to C++17 by right-click on the project in the
Solution Explorer to click on
Properties on the popup menu and on the
General tab, change the
C++ Language Standard from
Default(ISO C++14 Standard) to
Default ISO C++ 17 Standard (/std:c++17). Click Ok to close the
Properties dialog.