Commit f9cfdf9a by xiaotong

minus index

parent 5e169df8
......@@ -208,7 +208,11 @@ void XList::Insert(int pos, void * item)
/* get the item at position i */
void * XList::GetItem(int i) const
{
CheckNTErrors(i >= 0 && i < count, "Index of a list item is out of scope!");
CheckNTErrors(i >= -1 && i < count, "Index of a list item is out of scope!");
CheckNTErrors(count > 0, "Cannt index the item in an empty list!");
if(i == -1)
return items[count - 1];
else
return items[i];
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论