Abstract
Iterators are of central importance in the design of generic algorithms and collections, serving as intermediaries that enable generic algorithms to be written without concern for how collections are stored and collections to be written without having to code a large number of algorithms on them. A limitation of collection frameworks such as the C++ Standard Template Library (STL), the Java 2 platform, and the Java Generic Library is that they do not allow complete traversals, in which a collection might be modified by adding elements to it while it is being traversed by means of its associated iterators. Problems requiring complete traversals are fairly common, and while there are various ad hoc ways of solving them, programmers should ideally have at their command an efficient packaged solution. After reviewing prior work on extending generic algorithms and collections to support complete traversals, this paper describes a new generic component for complete traversals based on a design pattern extracted from a commonly used implementation of STL sorted associative containers. Also presented are the results of experiments to assess the performance of complete traversal components by randomly generating abstract instances of complete traversal problems. Finally, several theoretical results relating to computability and undecidability are established. It is shown that complete traversals are general enough that any computable relation can be expressed as an instance of them. Even assuming termination, however, the problem of determining whether a given complete traversal pattern always terminates in the same collection is shown to be undecidable.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.