文件名称:Policy Adaptors and the Boost Iterator Adaptor Library.pdf
文件大小:89KB
文件格式:PDF
更新时间:2012-08-20 10:38:47
C++ boost
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.