mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Correct instance lookup
This commit is contained in:
@@ -364,7 +364,15 @@ public:
|
|||||||
|
|
||||||
const std::vector<IfcUtil::IfcBaseEntity*>& insts = instances(t);
|
const std::vector<IfcUtil::IfcBaseEntity*>& insts = instances(t);
|
||||||
|
|
||||||
auto it = std::lower_bound(insts.begin(), insts.end(), v);
|
auto it = std::lower_bound(insts.begin(), insts.end(), v, [](IfcUtil::IfcBaseClass* other, IfcUtil::IfcBaseClass* val) {
|
||||||
|
// An ordering based on ID is not equivalent to an ordering based on pointer address!
|
||||||
|
return other->data().id() < val->data().id();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (it == insts.end()) {
|
||||||
|
throw std::runtime_error("Unable to find instance");
|
||||||
|
}
|
||||||
|
|
||||||
b = std::distance(insts.begin(), it);
|
b = std::distance(insts.begin(), it);
|
||||||
|
|
||||||
return std::make_pair(a, b);
|
return std::make_pair(a, b);
|
||||||
|
|||||||
Reference in New Issue
Block a user