From b7f73153cc4541b936f8ea0c805195428d7a7442 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 31 Jul 2023 16:01:29 +0800 Subject: [PATCH] Update unused filter() function --- src/ifcgeom/taxonomy.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ifcgeom/taxonomy.h b/src/ifcgeom/taxonomy.h index a3514fc475..042151f509 100644 --- a/src/ifcgeom/taxonomy.h +++ b/src/ifcgeom/taxonomy.h @@ -1189,15 +1189,17 @@ T* dcast(const U*& u) { // @nb traverses nested collections template - taxonomy::collection::ptr filter(taxonomy::collection* collection, Fn fn) { - auto filtered = new taxonomy::collection; + taxonomy::collection::ptr filter(taxonomy::collection::ptr collection, Fn fn) { + auto filtered = taxonomy::make(); for (auto& child : collection->children) { if (apply_predicate_to_collection(child, fn)) { filtered->children.push_back(clone(child)); } } if (filtered->children.empty()) { +#ifdef TAXONOMY_USE_NAKED_PTR delete filtered; +#endif return nullptr; } return filtered;