本文介绍了磁盘备份STL容器类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢开发使用STL算法,但是,我有这个经常出现的问题在我的数据集过大堆。

I enjoy developing algorithms using the STL, however, I have this recurring problem where my data sets are too large for the heap.

我一直在寻找直接替代的STL容器和算法这是磁盘备份,即对存储在磁盘上,而不是堆的数据结构。

I have been searching for drop-in replacements for STL containers and algorithms which are disk-backed, i.e. the data structures on stored on disk rather than the heap.

一个朋友最近向我指出对 stxxl 。之前,我也参与了它...任何其他磁盘备份STL替换用,我应该考虑?

A friend recently pointed me towards stxxl. Before I get too involved with it... Are any other disk-backed STL replacements available that I should be considering?

注:我没有兴趣在持续性或嵌入式数据库。请不要提的boost ::系列化,POST ++,关系模板库,Berkeley DB的,SQLite的,等我知道这些项目,并使用他们时,他们是适合我的目的。

更新:有几个人提到的内存映射文件,并使用自定义分配器,好的建议顺便说一句,但我要指出他们讨论的大卫亚伯拉罕表明,自迭代器,将需要磁盘备份的容器。这意味着自定义的分配器的方法是不可能奏效。

UPDATE: Several people have mentioned memory-mapping files and using a custom allocator, good suggestions BTW, but I would point them to the discussion here where David Abraham suggests that custom iterators would be needed for disk-backed containers. Meaning the custom allocator approach isn't likely to work.

推荐答案

我已经实现了一些东西非常相似。实施迭代是最具挑战性的。我用的 boost::iterator_facade实现迭代器。使用的boost :: iterator_facade 您可以轻松适应任何缓存在磁盘数据结构有一个STL容器接口。

I have implemented some thing very similar. Implementing the iterators is the most challenging. I used boost::iterator_facade to implement the iterators. Using boost::iterator_facade you can easy adapt any cached on disk data structures to have a STL container interface.

这篇关于磁盘备份STL容器类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 02:53