Boost logo

Boost :

From: Gavin Collings (gcollings_at_[hidden])
Date: 2000-12-05 04:53:54


--- In boost_at_[hidden], Kevlin Henney <kevlin_at_c...> wrote:

> But I agree that a straight run through all elements is important.
> Rather than conflict with STL requirements, it seems easy enough to
> add rather than mutate features.

[...]

> If I understand you correctly, this refers to the idea of having two
> versions of operator[]? This adds a little to the implementation,
> but IMHO complicates the class interface, which is currently a good
> and clear one.
>
> Thoughts?

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.

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 ); }
   };

Gavin


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