Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2000-12-05 05:17:59


In message <90idvi+rvtv_at_[hidden]>, Gavin Collings
<gcollings_at_[hidden]> writes
>Fair enough. Presenting a clean container interface is important,
>but there's more to a container interface than begin() and end().
>And I don't feel particularly comfortable cluttering the class
>interface with max_size_all(), size_all(), iterator_type_all etc.

Well, there is a certain consistency to the naming ;-)

However, whichever view was adopted as the default, the same issue would
apply to the other.

>All of those alls seem to hint at a commonality; better it would be
>to support the all element interface through a view: -
>
> class flattened_array
> {
> public:
>
> flattened_array( array * );
>
> // insert clean container interface here.
>
> private:
>
> array * array_;
> };
>
> class array
> {
> // ...
>
> flattened_array flat() { return flattened_array( this ); }
> };

This proxied view is a good, clean alternative to an adapted iterator.

Kevlin
____________________________________________________________

  Kevlin Henney phone: +44 117 942 2990
  Curbralan Limited mobile: +44 7801 073 508
  mailto:kevlin_at_[hidden] fax: +44 870 052 2289
  http://www.curbralan.com
____________________________________________________________


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