我想知道是否有人可以幫我修復此錯誤。我仔細看了看,看不出有什麼可能出錯。編譯器被點到線類型'_wrap_iter <pointer>'的非常量左值引用無法綁定到無關類型的值
while (_hasNextAttribute(it1, it2, thisAttribute))
以下代碼
bool HtmlProcessor::_processTag(std::string::const_iterator it1, const std::string::const_iterator it2, node & nd)
{
/*
[it1, it2): iterators for the range of the string
nd: node in which classes and ids of the tage are stored
Returns true or false depending on whether a problem was encountered during the processing.
*/
std::string elementType("");
while (_elementTypeChars.find(*it1) != std::string::npos && it1 != it2) elementType.push_back(*it1++);
if (elementType.empty()) return false;
nd.element_type = elementType;
std::vector<std::pair<std::string, std::string>> attributes;
const std::pair<std::string, std::string> thisAttribute;
while (_hasNextAttribute(it1, it2, thisAttribute))
attributes.push_back(thisAttribute);
return true;
}
bool HtmlProcessor::_hasNextAttribute(std::string::iterator & it1, const std::string::iterator & it2, const std::pair<std::string, std::string> attrHolder)
{
....
的
和跟它
非const左值參考輸入「_wrap_iter」不能結合至不相關的一個值類型'_wrap_iter'
顯示'_hasNextAttribute'(及其引用的任何其他類,例如'_wrap_iter')的定義 – 2014-11-05 05:49:20
雖然我猜測錯誤是它需要'thisAttribute'而不是'const' – 2014-11-05 05:49:50