From: Noah Stein (noah_at_[hidden])
Date: 2001-10-02 19:25:24
>I see the trade off, and now that I think about it I
>agree that deciding the size at compile time is too
>limiting. Fortunately, putting the COLS and ROWS as
>constructor parameters instead is an easy change.
I'm only in partial agreement. In my line of work, most of the code I write
deals with matrices whose sizes are known at compile time. Of course, I
also deal with matrices whose size is not known until run time. One of the
matrix libraries out there, MTL (IIRC), handles both situations with a
single class. When COLS or ROWS is zero, the size is run-time specifiable.
I haven't seen the grid class yet, so I don't know if this is compatible
with what you have already, but you could do something along the following
grid<T,5,7> g; // Compile-time 5x7 grid
gridT> g(5,7); // Run-time specified 5x7 grid
Just an idea.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk