2-dimensional ArrayList

  • Thread starter Thread starter Iwanow
  • Start date Start date
I

Iwanow

Hello!

Is it possible to use ArrayList as a 2-dimensional list? I want to keep
a bitmap in it, and I would like to access its elements by providing
two parameters (row and column) rather than calculating offset from the
begin. Thanks in advance for any hints.
 
pvdg42 said:
AFAIK, no. Feel free to research here:
Call me an idiot but what's wrong with a wrapper that
simply combines to indices into one (assuming the
OP really wants a 2-dimensional array - I'm not sure
what a 2-dimensional list would be)?

I.e. x[a,b] => y[a+b*dim(0)]

There are several ways to allocate the backing
store for the memory. Depending on the
requirements (specifically do the dimensions
change frequently?) you could also use a
CLR array which can have more than one
dimension, but has constant size for its
lifetime.

Oc, it might be useful to use a packed representation
if the logical element value range doesn't require all
bits of its physical backing store.

It really sounds like the OP wants either a CLR array
( array<X,N>^ where N>1) or a wrapper around a CLR vector
(array<X>^) with a custom indexer.

-hg

-hg

-hg
 
Back
Top