queue<string&> errors
问题 I have this interesting situation. I have a bunch of structs that hold a string. struct foo { string mStringName; } vector<foo> mFoos; I also have a queue of string references queue<string&> mStringQueue; And finally, I have a function that accepts a const string& void Bar(const string&); Heres the situation. //...in some loop currentFoo = mFoos[index]; // Queue up the string name. mStringQueue.push(currentFoo.mStringName); //...Later on, go through our queue and pass each one to the function