Policy Adaptors and the Boost Iterator Adaptor Library.pdf
Abstract. The iterator abstraction is one of the most commonly used in programming, but implementing an iterator type can be challenging. The requirements for a standard-conforming iterator are at once tedious and subtle: tedious because much of an iterator’s rich interface is “boilerplate” surrounding a few core operations, and subtle because of the intricate details involved in getting that interface right. This paper presents the generalized iterator template from the Boost Iterator Adaptor Library. In addition to automating the error-prone and redundant job of implementing new iterator types, the library simplifies the creation of iterator types that are variations on other iterators (adapted iterators) and generators of new iterator families (iterator adaptors). The Iterator Adaptor Library is an example of policy-based design and employs template meta-programming. We also present the Policy Adapter implementation pattern, a strategy which can also be used to generate new representatives of other abstract concept families. the error-prone and redundant job of implementing new iterator types, the library simplifies the creation of iterator types that are variations on other iterators (adapted iterators) and generators of new iterator families (iterator adaptors). The Iterator Adaptor Library is an example of policy-based design and employs template meta-programming. We also present the Policy Adapter implementation pattern, a strategy which can also be used to generate new representatives of other abstract concept families.
用户评论