• 您的位置我爱Aspx >> VC.Net >> Matt Austern : Defining Iterators and Const Iterators
  • Matt Austern : Defining Iterators and Const Iterators

  • 作者:aspxer  来源:internet  日期:2007-5-21 23:48:42  关键字:
  • Matt Austern : Defining Iterators and Const Iterators

    ign=center>The Standard Librarian: Defining Iterators and Const Iterators

    Matt Austern

    Writing an iterator isn’t hard, and it’s a natural way to extend the C++ Standard library. But if you want to do it right, there are a few wrinkles you ought to know about.

    The Standard C++ library is extensible by design: standard algorithms such as reverse and partition operate on the predefined containers like vector and list , and they can also operate on any user-defined data structure that supplies the appropriate iterators. Using the library effectively involves extending it.

    By now, iterators are familiar to most C++ programmers. Iterators abstract the most basic properties of pointers: a forward iterator points to some object in a sequence, and it can be incremented so that it points to the next element in the sequence. (Stronger iterator categories, bidirectional iterators and random access iterators, provide additional means of traversing sequences. Weaker iterator categories are inappropriate for most data structures.)

    我对这篇文章有话说?
  • 广告位招租,广告代号:content_468_15
  • 上一篇:vc调试经验
    下一篇:C++深度探索系列:智能指针(Smart Pointer) [二]
  • 相关文章