
9 Oct
2008
9 Oct
'08
5:15 p.m.
I think the following code would be easier: #include <map> #include <vector> typedef std::map<size_t, size_t> CInt2IntMap; typedef std::vector<size_t> CIntVector; static CInt2IntMap convert(const CIntVector &_r) { CInt2IntMap s; for (size_t i = 0; i < _r.size(); i++) s.insert(std::make_pair(_r[i], s.size())); return s; }