1

次の行はエラーでコンパイルされません。

No viable overloaded '='



std::string myString;
float myFloat;
boost::tuple<const std::string&, float> myTuple 
    = boost::tuple<const std::string&, float>(myString, myFloat);
std::vector<boost::tuple<const std::string&, float> > myVector;
myVector.push_back(myTuple);

誰も手がかりを持っています!? ヒント: 「const std::string&」を単純な std::string に置き換えれば、すべて問題ありません。

4

1 に答える 1

3

ベクトルのメンバーは、コピー割り当て可能(C ++ 98)または少なくとも移動可能(C ++ 11)である必要があります。参照はありません。

于 2012-11-13T18:24:05.340 に答える