Boost logo

Boost :

From: jhrwalter (walter_at_[hidden])
Date: 2002-01-17 09:53:42


--- In boost_at_y..., "vesa_karvonen" <vesa.karvonen_at_h...> wrote:
> --- In boost_at_y..., Toon Knapen <toon.knapen_at_s...> wrote:
> > I find the size1() and size2() not very intuitive unless their
> names are
> > chosen to align with the storage (major-row ?) in which case I
> think the
> > name breaks encapsulation.
> >
> > Would'nt it be easier to just call them nrows() and ncols() for
> instance ?
>
> hmm... I haven't been following this discussion, but if I
understand
> the topic correctly, then none of the names you are discussing
above
> are anywhere near optimal in my opinion.
>
> You really don't want to use distinct names for dimensions. If you
> do, then it is much more difficult to change the order in which you
> traverse 2 or more dimensional arrays (I guess these are matrices
in
> this case). I've done this design mistake in that past and I know
> from experience that it leads to unnecessary duplication of code.
>
> So, consider using something like size(dimension) instead.

Correct. I'd especially like to get templated versions of matrix row
and column iterators (template<int R> class iterator), but I don't
know how to convince the most popular compiler to translate such
code ;-)

Regards

Joerg


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