This is just a 'what if'/theoretical post with no current application.
Inspired by a talk about the advantages of range's over iterators in the stl, in my spare time I've been writing a 'stl' like library (a few containers and algorithms) that primarily uses ranges over iterators. Its been an interesting learning experience, and for the most part works. One thing I've disliked about the stl is allocators and I've been contemplating various alternatives.
Lately I've been reading about advances in non-volatile memory. Now we may have, in the near future, no hard drives; in that the ram is essentially the hard drive. And this got me thinking. If all ram were non-volatile, and there essentially was no hard drive, how would this change how we approached data management when programming? Clearly there would still be the stack, and temporary/scratch data, but it still brings up some interesting questions on how we manage data. How do we efficiently manage permanent data structures? Can permanent data structures become the norm? The current stl containers are clearly not designed to be portable, relocatable, or permanent, in any way. How would this affect iterators, and ranges? Pointers?
So with this in mind, I was wondering how I would write containers/allocators that would handle these things efficiently. My first thoughts went to the old x86 protected mode, which had segmentation. By having separate heaps or segments, you could have a container (or containers) on a given heap, and as long as the heap identifiers didn't change between program executions you have essentially portable and relocatable (to an extent) data structures. With a 64-bit pointer, having the high 16 bits be a 'segment selector', still gives the low 48-bits for an 'offset' (256 terrabytes seems large enough). Might need some sort of look-up table as x64 systems don't support segments in hardware. Also numeric ids are not always easy to work with, in theory you'd want to give the heaps names or other sensible identifiers.
Anyways at this point there are dozens different ideas, each with varying pro and cons. So, if you could re-write the stl containers/allocators, what would you do? Is it worth it or not? Can we support some more capabilities? What are the trade-offs?