next up previous
Next: Views, Smart Iterators, and Up: The View Template Library Previous: The View Template Library

Introduction

Since the STL and its iterator concept became popular in the C++ world, a variety of smart iterators [1,3] have been constructed. These smart iterators encapsulate both an iterator and a modifying or filtering algorithmic part, thus providing a different view onto the data pointed to by the iterator. Smart iterators form a kind of iterator adaptors.

This technique can be extended to construct container adaptors bundling a container and an algorithmic part, providing a different view onto the data elements in the container. In contrast to smart iterators, views provide a container interface instead of an iterator interface.

This concept has been developed by Seymour [11] and subsequently been extended and implemented using advanced C++ template features by Powell and Weiser in the View Template Library (VTL) [9,8]. This paper describes the design of the VTL as well as the implementation techniques that have been used to create a highly flexible though easily usable library.

Similar special purpose container adaptors can be found e.g. in the Matrix Template Library [12]. There are container adaptors providing scaled vector and matrix views, sparse vector representations from dense data storage, and strided vector views.


next up previous
Next: Views, Smart Iterators, and Up: The View Template Library Previous: The View Template Library
Martin Weiser 2000-09-29