I am continuing this post after This we have a class as:
class LaneConnector {
public:
const Lane* getLaneFrom() const {
return From;
}
con
std::set
keeps track of elements based on the key. In your comparator you have return a->getLaneID() < b->getLaneID();
. Thus Lane ID
implicitly becomes the key. Since if a
and b
have the same LaneID
, then both MyLaneConectorSorter(a, b)
and MyLaneConectorSorter(b, a)
are returning false
.
Your set
thus can not contain more than one LaneConnectior
with the same LaneID
.