MCPcopy Create free account
hub / github.com/csmith-project/csmith / sorted_insert

Method sorted_insert

src/ProbabilityTable.h:125–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123
124template <class Key, class Value>
125void
126ProbabilityTable<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
155template <class Key, class Value>
156void

Callers

nothing calls this directly

Calls 3

get_keyMethod · 0.80
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected