MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / compare_collection

Function compare_collection

src/ifcgeom/taxonomy.cpp:300–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298
299 template <typename T>
300 bool compare_collection(const collection_base<T>& a, const collection_base<T>& b) {
301 if (a.children.size() == b.children.size()) {
302 auto at = a.children.begin();
303 auto bt = b.children.begin();
304 for (; at != a.children.end(); ++at, ++bt) {
305 const bool a_lt_b = less(*at, *bt);
306 const bool b_lt_a = less(*bt, *at);
307 if (!a_lt_b && !b_lt_a) {
308 // Elements equal.
309 continue;
310 }
311 return a_lt_b;
312 }
313 // Vectors equal, compare matrix (in case of mapped items).
314 return compare(*a.matrix, *b.matrix);
315 }
316 else {
317 return a.children.size() < b.children.size();
318 }
319 }
320
321 bool compare(const loop& a, const loop& b) {
322 return compare_collection<edge>(a, b);

Callers

nothing calls this directly

Calls 4

compareFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected