http://stxxl.sourceforge.net
<daniel.feist@student.kit.edu>
http://www.boost.org/LICENSE_1_0.txt
#include <stxxl/map>
#include <iostream>
#define DATA_NODE_BLOCK_SIZE (4096)
#define DATA_LEAF_BLOCK_SIZE (4096)
struct CompareGreater
{
bool operator () (const int& a, const int& b) const
{ return a > b; }
static int max_value()
{ return std::numeric_limits<int>::min(); }
};
int main()
{
typedef stxxl::map<int, char, CompareGreater, DATA_NODE_BLOCK_SIZE, DATA_LEAF_BLOCK_SIZE> map_type;
map_type my_map((map_type::node_block_type::raw_size)*3, (map_type::leaf_block_type::raw_size)*3);
my_map.insert(std::pair<int, char>(1, 'a'));
my_map.insert(std::pair<int, char>(2, 'b'));
my_map.insert(std::pair<int, char>(3, 'c'));
my_map.insert(std::pair<int, char>(4, 'd'));
my_map.erase(3);
map_type::iterator iter;
std::cout << "my_map contains:\n";
for (iter = my_map.begin(); iter != my_map.end(); ++iter)
{
std::cout << iter->first << " => " << iter->second << std::endl;
}
map_type::iterator iter_low, iter_up;
iter_low = my_map.lower_bound(1);
iter_up = my_map.upper_bound(3);
std::cout << "lower bound " << iter_low->second << ", upper bound " << iter_up->second << std::endl;
return 0;
}