Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2000-01-12 10:52:49


Dave Abrahams wrote on 1/11/2000 8:07 PM
>Also, I would particularly like to hear from Howard and Greg on this, since
>they have both had experience with proxied containers. Does this reflect the
>intended concept, or would it be acceptable for member access to fail for
>references?

I haven't been following this thread. But as my 0.02 has been requested,
I'll give it. Be forewarned that it may be way out in left field. :-)

I gave my thoughts on proxied container requirements in another thread
and I'll repeat it here. I chose to link the container requirement with
the algorithm and vice-versa:

>So at least for me, one requirement of a proxied iterator is that it
>offer a specialization of any method that the algorithm must call with a
>T& (e.g. sort requires swap(iter, iter)). And a requirement on the
>algorithm is that it not call anything taking a T& except for those
>methods that the proxied iterator are required to specialize.

This is result of my experience with vector<bool>. I don't have
extensive experience with proxied containers other than this one. But
the point is, if I'm wanting to sort a vector<bool>, I don't give a flip
if I can call flip on a reference. ;-) All I care about is that I can
call swap on two references. So I require:

                static void swap(reference x, reference y);

If the proxy has this, then the container is useful to me. If it
doesn't, then it is not.

Naturally my requirements for being useful are going to vary with
different algorithms.

So I don't know how you would word it, but the bottom line is that the
proxied container is useful if it works with the algorithm you want to
use it with. And that can involve more than just the implementation of
member functions in the proxy class. And the proxy need not completely
duplicate the functionality of an actual reference to be useful for a
given algorithm.

-Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk