Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::tuple in std::map
From: Pete Bartlett (pete_at_[hidden])
Date: 2015-06-06 03:31:57


> On 5 Jun 2015, at 13:21, Uthpal Urubail <uthpal.urubail_at_[hidden]> wrote:
>
> Experts,
> I am using boost::tuple as key in std::map. I would like to write my own comparison method (considering tolerance in comparison)

Map comparators must impose a strict weak ordering on the keys. Typically trying to use a tolerance means that transitivity is violated (ie a <= b and b <= c does not imply a <= c). If you must use floating point types as keys you need to be careful.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net