Boost logo

Boost :

Subject: Re: [boost] [review] Review of PolyCollection starts today (May 3rd)
From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2017-05-16 14:20:15


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<typename Model,typename Allocator>
> bool operator==(
> const poly_collection<Model,Allocator>& x,
> const poly_collection<Model,Allocator>& y)
> {
> typename poly_collection<Model,Allocator>::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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk