Boost logo

Boost :

From: Anders Edin (anders.edin_at_[hidden])
Date: 2004-10-11 12:18:32


Hello, I have a short suggestion about the interface for multi_array.

It is possible to query a multi_array<T,N> for information about the storage:

  // queries
...
  const size_type* shape() const;
  const index* strides() const;
  const index* index_bases() const;
...

It appears multi_array uses a boost::array internally to store this
information, and uses the data() method to return a pointer in the above
methods. Wouldn't it be better to return a reference to the array directly:

  // queries
...
  const array<size_type, N>& shape() const;
  const array<index, N>& strides() const;
  const array<index, N>& index_bases() const;
...

With this interface the information about the number of elements of shapes and
strides is not lost during the query.

-- 
Anders Edin, Sidec Technologies AB
Fogdevreten 2A, 171 77 Stockholm, Sweden
Phone: +46850884525, Fax: +46850884522

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