优化reverse

This commit is contained in:
邹晓航
2014-11-27 11:58:15 +08:00
parent 0e70978fcc
commit 3f3e167d81

View File

@@ -255,7 +255,7 @@ namespace TinySTL{
}
template<class T>
void List<T>::reverse(){//<2F><><EFBFBD><EFBFBD>β<EFBFBD>
if (empty() || size() == 1) return;
if (empty() || head.p->next == tail.p) return;
auto curNode = head.p;
head.p = tail.p->prev;
head.p->prev = nullptr;