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;
50 : used(
false ), everUsed(
false ) {
60 Area(
unsigned capacity,
double maxProbeRatio );
61 Area(
const Area& other );
67 void swap( Area* other ) {
69 swap( _capacity, other->_capacity );
70 swap( _maxProbe, other->_maxProbe );
71 swap( _entries, other->_entries );
76 boost::scoped_array<Entry> _entries;
80 static const unsigned DEFAULT_STARTING_CAPACITY = 20;
89 double maxProbeRatio = 0.05 );
103 size_t size()
const {
return _size; }
105 bool empty()
const {
return _size == 0; }
110 size_t capacity()
const {
return _area._capacity; }
112 V& operator[](
const K_L& key ) {
return get( key ); }
114 V& get(
const K_L& key );
119 size_t erase(
const K_L& key );
129 _max = _area->_capacity - 1;
138 const value_type* operator->()
const {
return &_area->_entries[_position].data; }
140 const value_type& operator*()
const {
return _area->_entries[_position].data; }
146 if ( _position > _max )
154 return _position == other._position;
157 return _position != other._position;
164 if ( _area->_entries[_position].used )
166 if ( _position >= _max ) {
196 int _find(
const K_L& key,
int hash,
int* firstEmpty )
const;
203 double _maxProbeRatio;
209 C_LS _convertorOther;
214#include "mongo/util/unordered_fast_key_table_internal.h"
Definition unordered_fast_key_table.h:121
Definition unordered_fast_key_table.h:41
const_iterator find(const K_L &key) const
Definition unordered_fast_key_table_internal.h:204
size_t size() const
Definition unordered_fast_key_table.h:103
size_t erase(const K_L &key)
Definition unordered_fast_key_table_internal.h:161
the main MongoDB namespace
Definition bulk_operation_builder.h:24
Definition unordered_fast_key_table.h:27