**
List 不能使用STL提供的算法 sort() , 必须使用自己定义的sort() member function,因为STL算法sort()只接受RamdonAccessIterator,它的实现代码如下,是一个quick sort;
**
list::sort的代码如下(sgi stl):
template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::sort()
{
// Do nothing if the list has length 0 or 1.
//以下判断如果是空链表,或者是只有一个元素,就不进行任何操作
//使用四则size()== 0 || size()== 1来判断,虽然可以但缓慢些
if (_M_node->_M_next != _M_node && _M_node->_M_next->_M_next != _M_node) {
//一些新的list作为中介数据存储区
list<_Tp, _Alloc> __carry;