Hi there,
For a maze generator I coded, I used a 2d array of struct Cell.
One of the generation algorithms required to create a list, that would eventually hold pointers to those Cells.
Then it was needed to choose one of the Cell pointers within the list, and work upon it. This one is easy, since I just need to reference to the pointer's location.
Thing is when I needed to do it vice versa - finding a list element based on the array index, (such as finding the list element that points to array[4][7] in the list, and removing it from the list), is where it gets nasty.
I solved it by iterating from list.begin() to list.end(), and comparing x and y values I added to Cell, but I'm not sure it's as fast a solution as can be.
Can I both-way link a list and an array?
Thanks!