pointers - C++: Which Data Type in STXXL is suitable to create External Memory Binary Search Tree? -


i want create external memory binary search tree data structure data sits in external memory using stxxl library.

for purpose, data type in stxxl suitable use nodes in tree. if use stxxl:vector nodes of tree, how hold pointers them.

i have read in stxxl:vector documentation not possible use pointers logical understand.

warning : not store references elements of external vector. such references might invalidated during following access elements of vector .

then question alternative hold binary search tree data structure using 'stxxl' data types ?

store iterators pointing elements instead of pointers/refs elements. pointers/refs invalidated because of paging to/from disk, iterators not invalidated.

ex:

// safe store this, not safe store &nodes[node_index]. stxxl::vector<node>::iterator node_it = nodes.begin() + node_index; 

... , const_iterator read-only purpose.

node_it not invalidated unless element removed. unlike stl, doesn't invalidated if things push_back. dereferencing write/read pages to/from disk (only reading const_iterator), , can treat pointer doesn't invalidated.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -