| 123 | |
| 124 | template <class Key, class Value> |
| 125 | void |
| 126 | ProbabilityTable<Key, Value>::sorted_insert(Entry *t) |
| 127 | { |
| 128 | assert(t); |
| 129 | |
| 130 | Key k = t->get_key(); |
| 131 | |
| 132 | if (table_.empty()) { |
| 133 | table_.push_back(t); |
| 134 | curr_max_key_ = k; |
| 135 | return; |
| 136 | } |
| 137 | |
| 138 | typename vector<Entry *>::iterator i; |
| 139 | for (i=table_.begin(); i!=table_.end(); i++) { |
| 140 | if (my_greater<Key, Value>(*i, k)) { |
| 141 | break; |
| 142 | } |
| 143 | } |
| 144 | //i = find_if(table_.begin(), table_.end(), std::bind2nd(std::ptr_fun(my_greater<Key, Value>), k)); |
| 145 | |
| 146 | if (i != table_.end()) { |
| 147 | table_.insert(i, t); |
| 148 | } |
| 149 | else { |
| 150 | table_.push_back(t); |
| 151 | curr_max_key_ = k; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | template <class Key, class Value> |
| 156 | void |