我目前正在執行鏈接列表的堆棧。當涉及重載「=」運算符時,我遇到了問題。我對做什麼非常無知。如果任何人都能指出我會朝着一個很棒的方向發展。鏈接列表堆棧操作符重載函數
//operator overload
template <class S>
const Stack<S>::operator=(const Stack& s)
{
if (s.isEmpty())
theFront = theTop = 0
else
{
NodePointer temp = q->theFront;
while(temp != 0)
{
push(temp->data);
temp = temp->next;
}
}
return *this;
}
我也收到此錯誤: 堆棧,性病::分配器>> ::節點::節點(性病:: basic_string的,性病::分配器>)」在C引用:\用戶\ JOHNNY \ DESKTOP \ STACK \ INFIX_TO_RPN.OBJ
這可以通過我的操作符重載函數來修復嗎?
這是非常感謝你! – Johnrad 2010-11-01 01:12:11
不客氣... – 2010-11-01 01:13:48
你有什麼想法,爲什麼我會得到這個錯誤? (std :: basic_string,std :: allocator >,std :: allocator >> :: Node :: Node
Johnrad
2010-11-01 01:18:43