View Template Library (VTL)


This is the upcoming project page of the View Template Library (VTL) written by Gary Powell and Martin Weiser. VTL is a thin yet flexible adaptor layer on top of the Standard Template Library (STL) for C++. Software and documentation are currently in alpha state, though slowly approaching beta state, and are available only at direct request to either Gary or Martin. During the next weeks, we will slowly move the more or less stable parts of the documentation to this web site. There may be several dead links.

About Views

A view is a container adaptor, that provides a container interface to

of the underlying container(s). Since views themselves provide the container interface, they can be easily combined and stacked. Because of template trickery, views can adapt their interface to the underlying container(s). More sophisticated template trickery makes this powerful feature easy to use.

Compared with smart iterators, views are just smart iterator factories.

There are some rather close semantic connections to relational algebra.

The VTL was heavily inspired by the Views library by Jon Seymour.

A note for CUJ readers: The documentation in the powell.zip archive on the CUJ ftp server contains stl: prefixes in several links. This way the documentation can be linked to an SGI STL documentation at an arbitrary location by running the shell script localize.sh with the STL documentation URL to substitute the stl: prefixes with the given URL. Unfortunately this handy script didn't make it into the archive. You can get it here.

Table of Contents

Index

  1. Views

    1. View Concept

    2. Single Container View Concept

    3. Dual Container View Concept

    4. Single Container Views

      1. Filter View presenting only elements for which a specified predicate is true.

      2. Transform View presenting the elements transformed by a specified transformation.

      3. Polymorphic View dereferences the given container's elements thus presenting references to elements when the container contains pointers to them.

      4. Downcast View presenting references to only the elements of a given subclass of a container containing pointers to polymorphic elements.

      5. Unique View presenting only the first of each sequence of equal elements (comparable to UNIX uniq command).

      6. Reverse View presenting the container reversed.

      7. Window View presenting a sliding window into the container.

    5. Single Container Views for Pair Associative Containers.

      1. Map keys presenting the keys of a Pair Associative Container.

      2. Map keys filtered view presenting the filtered keys of a Pair Associative Container.

      3. Map keys transformed view presenting the transformed keys of a Pair Associative Container

      4. Map keys view presenting the filtered and transformed keys of a Pair Associative Container

      5. Map values presenting the values of a Pair Associative Container.

      6. Map values filtered view presenting the filtered values of a Pair Associative Container.

      7. Map values transformed view presenting the transformed values of a Pair Associative Container.

      8. Map values view presenting the filtered and transformed values of a Pair Associative Container.

    6. Dual Container Views

      1. Zip View presenting pairs (a,b) of corresponding elements a and b of two specified contaieners.

      2. Crossproduct View presenting all possible pairs (a,b) for elements a and b of two specified containers.

      3. Union View presenting two containers concatenated.

      4. Concatenation View presenting a collection of containers concatenated.

      5. Views acting on sorted containers

        1. Pair Merge View combining pairs of corresponding elements a and b of two specified sorted containers.

        2. Set Union View presenting the sorted union of two sorted containers.

        3. Set Intersection View presenting the sorted intersection of two sorted containers.

        4. Set Difference View presenting the sorted set difference of two sorted containers.

        5. Set Symmetrical Difference View presenting the sorted set symmetrical difference of two sorted containers.

    7. Dual Container Views for unsorted containers.

      1. Difference View presenting the difference of two containers.

      2. Intersection View presenting the intersection of two containers.

      3. Symmetrical Difference View presenting the symmetrical difference of two containers.

    8. Views working on ranges

      1. Range View constructing a view from a range [first, last).

      2. Rotate View presenting a shifted and wrapped view onto a range [first, last).

  2. Utilities

    1. Tag Classes

      1. Const View Tag denoting a view should be immutable.

      2. Mutable View Tag denoting a view should be mutable.

    2. Traits Classes

      1. deconst_traits removing const specifiers from types

      2. const_traits get const specifiers from types

      3. pointer_traits get pointer specifiers from types

      4. reference_traits get reference specifiers from types

      5. dereference_traits get dereference specifiers from types

    3. Functors

      1. dereference dereferencing it's argument

      2. is_nonzero comparing it's argument with zero

Publications

G. Powell, M. Weiser: Views, A New Form of Container Adaptors. C/C++ Users Journal, April 2000

License

Copyright (c) 1999, 2000 Gary Powell
Copyright (c) 1999, 2000 Konrad Zuse Zentrum fuer Informationstechnik Berlin

This material is provided "as is", with absolutely no warranty expressed or implied. Any use is at your own risk.

Permission to use or copy this software for any purpose is hereby granted without fee, provided the above notices are retained on all copies. Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice.


Last change: 2000-03-09