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.
A view is a container adaptor, that provides a container interface to
parts of the data or
transformed data or
a suitable combination of the data sets
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.
Views
Single Container Views
Filter View presenting only elements for which a specified predicate is true.
Transform View presenting the elements transformed by a specified transformation.
Polymorphic View dereferences the given container's elements thus presenting references to elements when the container contains pointers to them.
Downcast View presenting references to only the elements of a given subclass of a container containing pointers to polymorphic elements.
Unique View presenting only the first of each sequence of equal elements (comparable to UNIX uniq command).
Reverse View presenting the container reversed.
Window View presenting a sliding window into the container.
Single Container Views for Pair Associative Containers.
Map keys presenting the keys of a Pair Associative Container.
Map keys filtered view presenting the filtered keys of a Pair Associative Container.
Map keys transformed view presenting the transformed keys of a Pair Associative Container
Map keys view presenting the filtered and transformed keys of a Pair Associative Container
Map values presenting the values of a Pair Associative Container.
Map values filtered view presenting the filtered values of a Pair Associative Container.
Map values transformed view presenting the transformed values of a Pair Associative Container.
Map values view presenting the filtered and transformed values of a Pair Associative Container.
Dual Container Views
Zip View presenting pairs (a,b) of corresponding elements a and b of two specified contaieners.
Crossproduct View presenting all possible pairs (a,b) for elements a and b of two specified containers.
Union View presenting two containers concatenated.
Concatenation View presenting a collection of containers concatenated.
Views acting on sorted containers
Pair Merge View combining pairs of corresponding elements a and b of two specified sorted containers.
Set Union View presenting the sorted union of two sorted containers.
Set Intersection View presenting the sorted intersection of two sorted containers.
Set Difference View presenting the sorted set difference of two sorted containers.
Set Symmetrical Difference View presenting the sorted set symmetrical difference of two sorted containers.
Dual Container Views for unsorted containers.
Difference View presenting the difference of two containers.
Intersection View presenting the intersection of two containers.
Symmetrical Difference View presenting the symmetrical difference of two containers.
Views working on ranges
Range View constructing a view from a range [first, last).
Rotate View presenting a shifted and wrapped view onto a range [first, last).
Utilities
Tag Classes
Const View Tag denoting a view should be immutable.
Mutable View Tag denoting a view should be mutable.
Traits Classes
deconst_traits removing const specifiers from types
const_traits get const specifiers from types
pointer_traits get pointer specifiers from types
reference_traits get reference specifiers from types
dereference_traits get dereference specifiers from types
Functors
dereference dereferencing it's argument
is_nonzero comparing it's argument with zero
G. Powell, M. Weiser: Views, A New Form of Container Adaptors. C/C++ Users Journal, April 2000
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