From: Dietmar Kuehl (dietmar_kuehl_at_[hidden])
Date: 2003-01-06 19:57:09
First, please excuse that I'm answering *that* late to this mail but I just
accidentally tripped over this message and I'm hoping that a late answer
is better than none at all.
On Tuesday 12 November 2002 12:32 pm, Wesley W. Terpstra wrote:
[Solutions 1 - 4 remove]
Solution 5: use a property map based implementation of <algorithm>
The problem you identified (need to access references from STL
algorithms rather than separated get/set operations) is one of the
problem recognized quite a while ago (just look for "proxy containers"
like our favorite non-container 'std::vector<bool>'). This problem plus
several others is addressed by separating positioning (using iterators)
and property access (using property maps). Since the STL algorithms
are tightly bound to the abstractions upon which they are built, this
separation requires a new implementation of the algorithms library
built upon the two new abstraction (well, only property maps are "new"
but the iterator abstraction is changed in a subtle way, too).
I have a rather complete implementation of all algorithms similar to
those in <algorithm> based on property maps implemented. The
resulting algorithms can be used identically to the algorithms in the
standard library using a default property map which just assumes that
the iterators actually provide access to a reference. However, internally
'get()' and 'put()' functions are used to access the properties. A major
ommission of my implementation is the documentation... However,
property maps are described in "The Boost Graph Library" by Jeremy
Siek et al. (Addison-Wesley) and there are tests which can be used to
see how the algorithms can be used. The implementation can be
downloaded from <http://www.dietmar-kuehl.de/cool/cool-20030106.tar.gz>.
-- <mailto:dietmar_kuehl_at_[hidden]> <http://www.dietmar-kuehl.de/> Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk