darkloz
darkloz

Reputation: 11

external memory vector

I am developing an external memory data structure, and I need to put the data into a vector structure that automatically make swapping (maybe using LRU strategy) in order to keep a fixed RAM memory. I have tried the stxxl vector structure, but the problem is that it cannot store dynamic structures like std::vector. This doesn't work:

stxxl::vector< std::vector<T> >

Is there any library of external memory structure that could deal with these kind of elements?

Upvotes: 1

Views: 1096

Answers (1)

ch0kee
ch0kee

Reputation: 746

Template parameter of stxxl::vector is the type of contained items, but std::vector is not a type, its missing it's template argument.

Try e.g. stxxl::vector<std::vector<int> >, or create an enclosing template class around stxxl::vector if you want to parametrize the itemtype of std::vector.

UPDATE: After some research, I found this on the Stxxl: FAQ's first page http://algo2.iti.kit.edu/stxxl/trunk/FAQ.html

Parameterizing STXXL Containers

STXXL container types like stxxl::vector can be parameterized only with a value type that is a POD (i. e. no virtual functions, no user-defined copy assignment/destructor, etc.) and does not contain references (including pointers) to internal memory. Usually, "complex" data types do not satisfy this requirements.

This is why stxxl::vector<std::vector<T> > and stxxl::vector<stxxl::vector<T> > are invalid. If appropriate, use std::vector<stxxl::vector<T> >, or emulate a two-dimensional array by doing index calculation.

Upvotes: 6

Related Questions