I want to represent 2^32 elements in a vector. In reality, I allocate about 500,000 elements and then everything else is there to be used by my program (for storage of data). So I have to have say..
elements:
[0-999999] = 0
[100000-599999] = info
[600000 +] = 0 <-really big
I have to be able to place some value into any of the elements that start out with a 0 in it (in our case). The problem is that that means I have to allot a huge amount of memory just to initialize my program. Is there a good way to generate this association to my vector without actually allocating space until it's actually needed?
So in otherwords, can I define elements of a vector without allocating memory for them? I want to be able to fill the vector with all the actual data I have at start-up but I then need to be able to assign vector element [lets say 3] to a value, then generate space in memory for it. This seems like it would require vector to not have consecutive element indexes.
Any ideas?