The view library

An iterator adaptor wraps a "dumb" STL iterator and adds some functionality; such an object is often referred to as a smart iterator. In much the same way, a container adaptor or view wraps a STL container and attaches some further functionality.

A view is (intended to be) a light-weight, immutable decorator to some existing data. Usually, it will provide the same interface as a STL container, but nothing further. Especially, a view will not implement methods such as insert() and erase() which would modify the underlying container.

This implementation tries to keep the relation between adapted (or "smart") iterators and views as close as possible. This means that a view acts like a container which has an adapted iterator type as its iterator type. For instance, a filter_view<...> will define boost::filter_iterator_generator<...>::type as its filter_view::iterator type; its methods begin() and end() will return filter iterators, etc.

Usage

Sorry, no online documentation so far; meanwhile, check out the test examples from the Boost Sandbox CVS repository, or from here.

Portability

The view library has been tested with gcc 2.95.3-6 (mingw special) and gcc 3.2 (cygwin) together with Boost 1.29.0, and with MSVC++ 7.0 using Boost 1.28.0.

History

The first to introduce a view library was Jon Seymour back in 1995.

The most complete implementation of views so far is the View Template Library by Gary Powell and Martin Weiser [PW99], [WP00].

Acknowledgements

Gary Powell and Martin Weiser provided inspiration, ideas and feedback. The implementation of cyclic_iterator is based upon the work of Gennadiy Rozental.

References

[PW99] Gary Powell and Martin Weiser, Container adaptors, Tech. Report SC 99-41, Konrad- Zuse-Zentrum für Informationstechnik Berlin, 1999, also appeared in: C/C++ Users Journal, 18 (2000), No. 4,40-51.

[Ric02a] Roland Richter, The data/view model, Tech. Report FLLL-TR-0204, Fuzzy Logic Laboratorium Linz-Hagenberg, 2002.

[Ric02b] Roland Richter, A Catalogue of Views, Tech. Report FLLL-TR-0209, Fuzzy Logic Laboratorium Linz-Hagenberg, 2002.

[WP00] Martin Weiser and Gary Powell, The View Template Library, First Workshop on C++ Template Programming, Erfurt, Germany, October 10 2000.


Last modified 28 Oct 2002.

Copyright © Roland Richter 2002. Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.