//tuple
std::tuple<int, int, int, int, QString> Thorface::getUserInfoToJudgeOpendoor(QString strUserCode) { int iunpaidOrderList = 0; int iunhandledOrderList = 0; int istatus = 0; int ibindFace = 0; QString strUserName = ""; return std::make_tuple(iunpaidOrderList, iunhandledOrderList, istatus, ibindFace, strUserName); }
//tie解析
int iunpaidOrderList = 0;
int iunhandledOrderList = 0;
int istatus = -1;
int ibindFace = -1;
QString strUserName = "";
std::tie(iunpaidOrderList, iunhandledOrderList, istatus, ibindFace, strUserName) = getUserInfoToJudgeOpendoor(strName);
tuple是一個固定大小的不一樣類型值的集合,是泛化的std::pair。和c#中的tuple相似,可是比c#中的tuple強大得多。咱們也能夠把他當作一個通用的結構體來用,不須要建立結構體又獲取結構體的特徵,在某些狀況下能夠取代結構體使程序更簡潔,直觀。c#