20 #include <boost/smart_ptr/scoped_array.hpp>
22 #include "mongo/base/disallow_copying.h"
26 template <
typename K_L,
typename K_S>
28 K_S operator()(
const K_L& a)
const {
33 template <
typename K_L,
43 typedef std::pair<K_S, V> value_type;
45 typedef V mapped_type;
49 Entry() : used(
false), everUsed(
false) {}
58 Area(
unsigned capacity,
double maxProbeRatio);
59 Area(
const Area& other);
61 int find(
const K_L& key,
68 void swap(Area* other) {
70 swap(_capacity, other->_capacity);
71 swap(_maxProbe, other->_maxProbe);
72 swap(_entries, other->_entries);
77 boost::scoped_array<Entry> _entries;
81 static const unsigned DEFAULT_STARTING_CAPACITY = 20;
90 double maxProbeRatio = 0.05);
115 size_t capacity()
const {
116 return _area._capacity;
119 V& operator[](
const K_L& key) {
123 V&
get(
const K_L& key);
128 size_t erase(
const K_L& key);
140 _max = _area->_capacity - 1;
149 const value_type* operator->()
const {
150 return &_area->_entries[_position].data;
153 const value_type& operator*()
const {
154 return _area->_entries[_position].data;
161 if (_position > _max)
169 return _position == other._position;
172 return _position != other._position;
178 if (_area->_entries[_position].used)
180 if (_position >= _max) {
210 int _find(
const K_L& key,
int hash,
int* firstEmpty)
const;
217 double _maxProbeRatio;
223 C_LS _convertorOther;
227 #include "mongo/util/unordered_fast_key_table_internal.h"
size_t size() const
Definition: unordered_fast_key_table.h:104
Definition: unordered_fast_key_table.h:27
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
size_t erase(const K_L &key)
Definition: unordered_fast_key_table_internal.h:150
Definition: unordered_fast_key_table.h:41
const_iterator find(const K_L &key) const
Definition: unordered_fast_key_table_internal.h:191
UnorderedFastKeyTable(unsigned startingCapacity=DEFAULT_STARTING_CAPACITY, double maxProbeRatio=0.05)
Definition: unordered_fast_key_table_internal.h:96
Definition: unordered_fast_key_table.h:130