Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

infinite array in c++

Name: cvtc user 2006-02-25 1:24

i need help making an infinite two dimensional array in c++, in other words, i have no clue how to do it....

can anyone help?

Name: Anonymous 2006-02-25 3:36

Well, if some of the language constructs are lazily evaluated, there is such a thing. Haskell, for example, allows such things.

I can't imagine how you'd do it in C++ though. Create your own ADT that behaves like an array but is a hash or tree internally? Probably implemented in the same way as a sparse array.

Name: Anonymous 2006-02-25 3:44

he probably wants a linked list, shitheads.

Name: Anonymous 2006-02-25 3:51

If you are allowed to use the STL then the vector template is your best friend.
Otherwise just make a linked list of linked lists.

Name: Anonymous 2006-02-25 4:47

>>4
A single linked list is a poor fit for a 2D sparse array.

>>5
I'm not certain a vector is a good choice.
a) It can't handle arbitrary-length integers
b) Sucks for sparse arrays.

Maybe you ment map?

Name: Anonymous 2006-02-25 7:53

You can use a [*] array in C.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List