template<class KeyType, class DataType, class CompareType, unsigned RawNodeSize = 16* 1024, unsigned RawLeafSize = 128* 1024, class PDAllocStrategy = stxxl::SR>
class stxxl::map< KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy >
External associative container (map).
Introduction to map container: see STXXL Map (B+-tree) tutorial.
Design and Internals of map container: see Map (B+-tree).
- Template Parameters
-
KeyType | key type (POD with no references to internal memory) |
DataType | data type (POD with no references to internal memory) |
CompareType | comparison type used to determine whether a key is smaller than another one. If CompareType()(x,y) is true, then x is smaller than y. CompareType must also provide a static max_value method, that returns a value of type KeyType that is larger than any key stored in map : i.e. for all x in map holds CompareType()(x,CompareType::max_value()) |
Example: :
struct CmpIntGreater
{
bool operator () (const int & a, const int & b) const { return a>b; }
static int max_value() { return std::numeric_limits<int>::min(); }
};
Another example:
struct CmpIntLess
{
bool operator () (const int & a, const int & b) const { return a<b; }
static int max_value() const { return std::numeric_limits<int>::max(); }
};
Note that CompareType must define a strict weak ordering. (see what it is)
- Template Parameters
-
RawNodeSize | size of internal nodes of map in bytes (btree implementation). |
RawLeafSize | size of leaves of map in bytes (btree implementation). |
PDAllocStrategy | parallel disk allocation strategy (stxxl::SR is recommended and default) |
- Examples:
- examples/containers/map1.cpp.
Definition at line 82 of file map.h.
|
|
iterator | begin () |
|
iterator | end () |
|
const_iterator | begin () const |
|
const_iterator | end () const |
|
const_iterator | cbegin () const |
|
const_iterator | cend () const |
|
reverse_iterator | rbegin () |
|
const_reverse_iterator | rbegin () const |
|
const_reverse_iterator | crbegin () const |
|
reverse_iterator | rend () |
|
const_reverse_iterator | rend () const |
|
const_reverse_iterator | crend () const |
|
|
size_type | size () const |
|
size_type | max_size () const |
|
bool | empty () const |
|
|
key_compare | key_comp () const |
|
value_compare | value_comp () const |
|
|
| map (unsigned_type node_cache_size_in_bytes, unsigned_type leaf_cache_size_in_bytes) |
| A constructor. More...
|
|
| map (const key_compare &c_, unsigned_type node_cache_size_in_bytes, unsigned_type leaf_cache_size_in_bytes) |
| A constructor. More...
|
|
template<class InputIterator > |
| map (InputIterator b, InputIterator e, unsigned_type node_cache_size_in_bytes, unsigned_type leaf_cache_size_in_bytes, bool range_sorted=false, double node_fill_factor=0.75, double leaf_fill_factor=0.6) |
| Constructs a map from a given input range. More...
|
|
template<class InputIterator > |
| map (InputIterator b, InputIterator e, const key_compare &c_, unsigned_type node_cache_size_in_bytes, unsigned_type leaf_cache_size_in_bytes, bool range_sorted=false, double node_fill_factor=0.75, double leaf_fill_factor=0.6) |
| Constructs a map from a given input range. More...
|
|
|
void | swap (map &obj) |
|
std::pair< iterator, bool > | insert (const value_type &x) |
|
iterator | insert (iterator pos, const value_type &x) |
|
template<class InputIterator > |
void | insert (InputIterator b, InputIterator e) |
|
void | erase (iterator pos) |
|
size_type | erase (const key_type &k) |
|
void | erase (iterator first, iterator last) |
|
void | clear () |
|
|
iterator | find (const key_type &k) |
|
const_iterator | find (const key_type &k) const |
|
size_type | count (const key_type &k) |
|
iterator | lower_bound (const key_type &k) |
|
const_iterator | lower_bound (const key_type &k) const |
|
iterator | upper_bound (const key_type &k) |
|
const_iterator | upper_bound (const key_type &k) const |
|
std::pair< iterator, iterator > | equal_range (const key_type &k) |
|
std::pair< const_iterator,
const_iterator > | equal_range (const key_type &k) const |
|
|
data_type & | operator[] (const key_type &k) |
|
|
void | enable_prefetching () |
| Enables leaf prefetching during scanning. More...
|
|
void | disable_prefetching () |
| Disables leaf prefetching during scanning. More...
|
|
bool | prefetching_enabled () |
| Returns the status of leaf prefetching during scanning. More...
|
|
void | print_statistics (std::ostream &o) const |
| Prints cache statistics. More...
|
|
void | reset_statistics () |
| Resets cache statistics. More...
|
|
|
template<class KeyType_ , class DataType_ , class CompareType_ , unsigned RawNodeSize_, unsigned RawLeafSize_, class PDAllocStrategy_ > |
bool | operator!= (const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &a, const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &b) |
|
template<class KeyType_ , class DataType_ , class CompareType_ , unsigned RawNodeSize_, unsigned RawLeafSize_, class PDAllocStrategy_ > |
bool | operator< (const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &a, const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &b) |
|
template<class KeyType_ , class DataType_ , class CompareType_ , unsigned RawNodeSize_, unsigned RawLeafSize_, class PDAllocStrategy_ > |
bool | operator<= (const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &a, const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &b) |
|
template<class KeyType_ , class DataType_ , class CompareType_ , unsigned RawNodeSize_, unsigned RawLeafSize_, class PDAllocStrategy_ > |
bool | operator== (const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &a, const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &b) |
|
template<class KeyType_ , class DataType_ , class CompareType_ , unsigned RawNodeSize_, unsigned RawLeafSize_, class PDAllocStrategy_ > |
bool | operator> (const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &a, const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &b) |
|
template<class KeyType_ , class DataType_ , class CompareType_ , unsigned RawNodeSize_, unsigned RawLeafSize_, class PDAllocStrategy_ > |
bool | operator>= (const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &a, const map< KeyType_, DataType_, CompareType_, RawNodeSize_, RawLeafSize_, PDAllocStrategy_ > &b) |
|