我正在嘗試這樣做。C++ 11。如何從沒有const的元組中獲取元素
int flag = 0;
if(big.size() <= small.size())
flag = 1; //use float
tuple<long, float> tup (1234.5678, 12341234.1234);
auto foo = get<flag>(tup);
但我得到的錯誤:
error: the value of 'flag' is not usable in a constant expression
cout << get<flag>(tup);
- 和 -
note: 'int flag' is not const
int flag = 0;
我的問題是瑪麗有隻小羊羔到指環王 – djent