Hi,
It's a long time since I did any programming, but if I were tackling this problem I think I'd build the data structure myself to exactly meet the requirements.
I would devide the space into rectalinear regions (i.e square in 2-D, cube in 3-D) and then hold an Object Location Table for each region.
The object location table would hold N+1 (where N is the number of dimesions of your space) values per object, namely:
Pointer to Object
Dimenstion 1 location
...
Dimension N location
Though on reflection you might want to add an "Existance" Flag so that you can maintain spare rows in the tables and avoid resizing them when adding or deleting an object from a particualr region. A null pointer might be the Non-Existance Flag.
Also... if the objects themselves have signifcant size you might need to store some size parameter (max distance from object referance point to any point in it's surface)
You can easily compute which regions are adjacent (or close to) any other, and a proximity search from a given point would be trivial:
all objects in any region entirely within the required range of specified point
range test on all objects in any region partially but not entirely within the required range of the specified point.
The issue then arises of how big to make the regions, and how to manage the Object Location Tables in terms of their size. Much depends on the total number of objects you want to manage
Lets say you subdivide your space so that the linear dimensions of the regions is 1/100th of the size of your space, then in 3D you have 1000000 regions. Much then depends on how many objects you plan to track. If this is a climate or weather-forcasting model, tracking billios of molecules, a mere 1000000 regions is nothing, and all will be heavily populated; but if you have a relitively small number of objects, then many of the regions will be empty. The obvious thing to do is then to (slightly) increase the region size and implment a quick reference to non-empty regions. If you do this correctly the total space could potentially be infinite (i.e. limited only by the range of intergers in you machine needed to address each dimension), provided the total number of objects does not run you out of virtual memory.
However, the speed of access/searching improves as you restrict the total size of your space relative to your region size. The is a break point at around 1000,000,000 regions (i.e. the space is 1000 regions long along each of three dimension) because you can then encode the region location (identity) into a 32bit integer, and another at around 1000,000 regions or so, because at that point a boolean string (1 bit per region) saying whether each region is empty or not becomes managable.
To answer your next question - No, I don't envisage the Object Location Tables as separate variables of dynamic size managed by C++, I think a single N+1 column table which you manage yourself as a set of dynamic stacks would be much more efficient.
If you could give more info on the number and size of the objects, relative to the size of the space it would make this easier to design.
Peter