Basic vector implementation, which stores all data in a list of fixed-sized blocks. More...
#include <mitsuba/render/gkdtree.h>
Public Member Functions | |
BlockedVector () | |
~BlockedVector () | |
void | push_back (const T &value) |
Append an element to the end. More... | |
T *__restrict | allocate (size_t size) |
Allocate a certain number of elements and return a pointer to the first one. More... | |
T & | operator[] (size_t index) |
const T & | operator[] (size_t index) const |
size_t | size () const |
Return the currently used number of items. More... | |
size_t | blockCount () const |
Return the number of allocated blocks. More... | |
size_t | capacity () const |
Return the total capacity. More... | |
void | resize (size_t pos) |
Resize the vector to the given size. More... | |
void | clear () |
Release all memory. More... | |
Basic vector implementation, which stores all data in a list of fixed-sized blocks.
This leads to a more conservative memory usage when the final size of a (possibly very large) growing vector is unknown. Also, frequent reallocations & copies are avoided.
|
inline |
|
inline |
|
inline |
Allocate a certain number of elements and return a pointer to the first one.
The implementation will ensure that they lie contiguous in memory – note that this can potentially create unused elements in the previous block if a new one has to be allocated.
|
inline |
Return the number of allocated blocks.
|
inline |
Return the total capacity.
|
inline |
Release all memory.
|
inline |
|
inline |
|
inline |
Append an element to the end.
|
inline |
Resize the vector to the given size.
Note: this implementation doesn't support enlarging the vector and simply changes the last item pointer.
|
inline |
Return the currently used number of items.