Sender: hhuu (I love XXX), the letter area: Programming Title: Boost :: Iterator_Adaptor (III) Send Station: BBS Shuimu Tsinghua Station (Mon May 20 17:57:07 2002)
I have taught it before, I finally discussed the meaning of the existence.;)
Iterator is one of the features of STL. Traverse the container through the Iterator, pass the * Iterator to access the elements in the container, such an idea obviously picks the pointer. About the ratio of the Iterator and Doc / View structures, previously mentioned in the BliTZ document (the discussion of the C technique). The idea mentioned in the article is not very suitable. In fact, every item can be seen as a view! By changing the tip of different views for the same DATA, what is the initial motivation to use Iterator_Adaptor.
I think that Adaptor here is not in line with the actual meaning. In most cases, Iterator_adaptor is a packaged Iterator to modify its behavior. I hope everyone can mention a better statement.
If you have something to understand for the Iterator, you can guess which template parameters do Iterator need. The most important thing among these parameters is Policy, this is a veritable very much, and the meaning of policy in DP. The processing method of the Iterator is to complete the operation of the Iterator to the policy. And you implement a method of your own policy is to inherit the default_policy and then cover it from your own method. For example, the default in String is moving by char, if you change the policy, make him press Word, what? Well, the specific implementation is Boost :: tokenize.
-
※ Source: · BBS Shuimu Tsinghua Station bbs.edu.cn · [from: 166.111.64.166]