#If I were to allocate an array of objects in heap memory...
10 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
Depends on your method
A linked list wouldn't do that, but stuff like T *t = new T[Size]; would (which is also what e.g. std::vector does)
iirc linked list does occupy random parts of memory and just binds elements to each other via pointing to such memory addresses...?
Correct
so it means that, let's say, the second element would not be located right after the first
In case of linked lists ? No. (Well, maybe there's a random chance that it could happen, but that's not reliable)
quantum bogo linked list ?
- Quantumly randomise the memory, such that there is no way of knowing what order the memory is in until it is observed. This will divide the universe into O(n!) universes; however, the division has no cost, as it happens constantly anyway.
- If the linked list does not occupy continuous block of memory, destroy the universe. (This operation is left as an exercise to the reader.)
- All remaining universes contain linked lists which are continuous.
!solved