Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2000-12-03 06:41:21


In message <90bn2c+o6d5_at_[hidden]>, Giovanni Bavestrelli
<gibav_at_[hidden]> writes
[...]
>As I mentioned, this is a fundamental issue. Which view do we
>privilege? In reality, I think we can provide both views, do you
>think that would be reasonable, or would it just complicate the
>interface? I hope we get many comments on this one!

I think both views are valid and important. My gut instinct, in terms of
defaults, is have the class follow the STL model. For some container c
with constant-time lookup and random access iterators the expectation
would be

        c.begin()[i] is equivalent to c[i]
        c.begin() + c.size() == c.end()

In other words, iterators and size should be per dimension by default.
This means that size returns a numeric quantity not a shape, except for
the limiting case of a single dimension. Sizing operations on all
dimensions should probably be in terms of shape and reshape functions,
and a shape_type. Whether to provide resize is another matter, but the
only dimension for which this both is convenient and makes sense is the
first.

To iterate over all elements conveniently there seem to be two choices:
(1) provide an adapter or (2) provide separate iterator access functions
eg begin_all and end_all.

Thoughts?

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