MCPcopy Create free account
hub / github.com/DFHack/dfhack / insert_into_vector

Function insert_into_vector

library/include/MiscUtils.h:234–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232
233template<typename FT>
234unsigned insert_into_vector(std::vector<FT> &vec, FT key, bool *inserted = NULL)
235{
236 unsigned pos = (unsigned)binsearch_index(vec, key, false);
237 bool to_ins = (pos >= vec.size() || vec[pos] != key);
238 if (inserted) *inserted = to_ins;
239 if (to_ins)
240 vector_insert_at(vec, pos, key);
241 return pos;
242}
243
244template<typename CT, typename FT, typename MT>
245unsigned insert_into_vector(std::vector<CT*> &vec, FT MT::*field, CT *obj, bool *inserted = NULL)

Callers 11

updateRoomAssignmentsMethod · 0.85
makeAnnouncementMethod · 0.85
autoDFAnnouncementMethod · 0.85
setOwnerMethod · 0.85
markForMeltingMethod · 0.85
insertMethod · 0.85
setAssignedUnitMethod · 0.85
addItemOnGroundMethod · 0.85
assignTrainerMethod · 0.85

Calls 3

binsearch_indexFunction · 0.85
vector_insert_atFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected