16 May
2017
16 May
'17
2:20 p.m.
Den 15-05-2017 kl. 21:21 skrev Joaquin M López Muñoz via Boost:
I think this variation of a) might perform better (code untested):
template
bool operator==( const poly_collection & x, const poly_collection & y) { typename poly_collection ::size_type s=0; const auto &mapx=x.map,&mapy=y.map; for(const auto& p:mapx){ s+=p.second.size(); auto it=mapy.find(p.first); if(it==mapy.end()?!p.second.empty():p.second!=it->second)return false; } if(s!=mapy.size())return false; return true; }
I not sure about this version. mapy.size() should be y.size() ?!? Or do you need sx and sy? But also, once all the segments have been compared in the loop, you know the x.size() == y.size() ... -Thorsten