Wouldn???t it work to instead of getEntityFromIterator(it) use getEntity(*it), which would be defined just as in your example except the last case would just do ???getEntity(const Entity& e) { return e;}??? plus a similar definition taking an Entity*.