difference between slist and list.
来源:互联网 发布:linux进入mysql命令行 编辑:程序博客网 时间:2024/05/16 23:40
The main difference between slist and list is that list's iterators are bidirectional iterators, while slist's iterators are forward iterators. This means that slist is less versatile than list; frequently, however, bidirectional iterators are unnecessary. You should usually use slist unless you actually need the extra functionality of list, because singly linked lists are smaller and faster than double linked lists.
Important performance note: like every other Sequence, slist defines the member functions insert and erase. Using these member functions carelessly, however, can result in disastrously slow programs. The problem is that insert's first argument is an iterator pos, and that it inserts the new element(s) before pos. This means that insert must find the iterator just before pos; this is a constant-time operation for list, since list has bidirectional iterators, but for slist it must find that iterator by traversing the list from the beginning up to pos. In other words: insert and erase are slow operations anywhere but near the beginning of the slist.
Slist provides the member functions insert_after and erase_after, which are constant time operations: you should always use insert_after and erase_after whenever possible. If you find that insert_after and erase_after aren't adequate for your needs, and that you often need to use insert and erase in the middle of the list, then you should probably use list instead of slist.
- difference between slist and list.
- Difference Between List and Tuples
- Is there any difference between List x; and List x();?
- The difference between (()) and ().
- difference between "<" and "<<"
- Difference between List and Set in Java Collection
- Difference between List and Set in Java Collection
- Difference between Set, List and Map in Java - Interview question
- Difference between List and Set in Java Collection
- Difference between List View and DataGrid in WPF
- Difference Between typedef and #define
- Difference between PCDATA and CDATA
- Difference between CComPtr and CComQIPtr
- Difference between RVCT and GCCE
- Difference between RVCT and GCCE
- difference between stack and heap
- Difference between replace and translate
- Difference between PrintWriter and PrintStream
- 入门影友晋级:RAW到底比JPEG强在哪里?
- Login控件也可添加图文验证码
- struts+hibernate(dao)+filter的例子
- 又去参观手术了
- 群发送邮件类
- difference between slist and list.
- 无奈的SSH(未完成,想参考的请勿入)
- asp.net页面间数据传递(总结篇)
- 猜它们表达的原著分别是什么(70-80年代出生的进)
- vc++6.0的一个BUG
- vector and bvector.
- GridView自定义分页导航
- VC中常用数据类型转换
- JFormattedTextField组件的文本选择问题