diff --git a/src/ifcgeom/kernels/opencascade/boolean_utils.cpp b/src/ifcgeom/kernels/opencascade/boolean_utils.cpp index 975ee00d0d..009cc9ee65 100644 --- a/src/ifcgeom/kernels/opencascade/boolean_utils.cpp +++ b/src/ifcgeom/kernels/opencascade/boolean_utils.cpp @@ -845,7 +845,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To std::string debug_identifier; if (debug) { - static my_thread_local size_t operation_counter_ = 0; + static thread_local size_t operation_counter_ = 0; std::stringstream ss; ss << "bool-" << std::this_thread::get_id() << "-" << (operation_counter_++); debug_identifier = ss.str(); diff --git a/src/ifcgeom/mapping/IfcObjectPlacement.cpp b/src/ifcgeom/mapping/IfcObjectPlacement.cpp index 9f5b07bee6..4b887b5fcc 100644 --- a/src/ifcgeom/mapping/IfcObjectPlacement.cpp +++ b/src/ifcgeom/mapping/IfcObjectPlacement.cpp @@ -50,7 +50,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) { relative_to = inst.PlacementRelTo(); #else if (inst.as()) { - relative_to = inst.as()->PlacementRelTo(); + relative_to = inst.as().PlacementRelTo(); } #endif diff --git a/src/ifcgeom/mapping/mapping.cpp b/src/ifcgeom/mapping/mapping.cpp index 034534e037..1f2118b557 100644 --- a/src/ifcgeom/mapping/mapping.cpp +++ b/src/ifcgeom/mapping/mapping.cpp @@ -325,30 +325,30 @@ const express::Base mapping::get_single_material_association(const express::Base } } if (associated_materials.size() == 1) { - IfcSchema::IfcMaterialSelect associated_material; + express::Base associated_material; try { - associated_material = associated_materials.front().RelatingMaterial(); + associated_material = associated_materials.front().RelatingMaterial().concrete(); } catch(IfcParse::IfcException& e) { Logger::Error(e.what()); } if (associated_material) { - // @todo make sure that chaining as() works in nullptrs - single_material = associated_material.as().as(); + single_material = associated_material.as(); + // NB: Single-layer layersets are also considered, regardless of --enable-layerset-slicing, this // in accordance with other viewers. if (!single_material) { - if (associated_material.as().as() || associated_material.as().as()) { + if (associated_material.as() || associated_material.as()) { IfcSchema::IfcMaterialLayerSet layerset; - if (auto m = associated_material.as().as()) { + if (auto m = associated_material.as()) { if (m.get("ForLayerSet").isNull()) { Logger::Warning("Missing ForLayerSet for:", m); return express::Base{}; } layerset = m.ForLayerSet(); } else { - layerset = associated_material.as().as(); + layerset = associated_material.as(); } if (settings_.get().value ? layerset.MaterialLayers().size() >= 1 : layerset.MaterialLayers().size() == 1) { IfcSchema::IfcMaterialLayer layer = layerset.MaterialLayers().front(); @@ -359,16 +359,16 @@ const express::Base mapping::get_single_material_association(const express::Base } #ifdef SCHEMA_HAS_IfcMaterialProfileSet - if (associated_material.as().as() || associated_material.as().as()) { + if (associated_material.as() || associated_material.as()) { IfcSchema::IfcMaterialProfileSet profileset; - if (auto m = associated_material.as().as()) { + if (auto m = associated_material.as()) { if (m.get("ForProfileSet").isNull()) { Logger::Warning("Missing ForProfileSet for:", m); return express::Base{}; } profileset = m.ForProfileSet(); } else { - profileset = associated_material.as().as(); + profileset = associated_material.as(); } if (settings_.get().value ? profileset.MaterialProfiles().size() >= 1 : profileset.MaterialProfiles().size() == 1) { IfcSchema::IfcMaterialProfile profile = profileset.MaterialProfiles().front(); @@ -380,8 +380,8 @@ const express::Base mapping::get_single_material_association(const express::Base #endif #ifdef SCHEMA_HAS_IfcMaterialConstituentSet - if (associated_material.as().as() && associated_material.as().as().MaterialConstituents()) { - IfcSchema::IfcMaterialConstituentSet constituentset = associated_material.as().as(); + if (associated_material.as() && associated_material.as().MaterialConstituents()) { + IfcSchema::IfcMaterialConstituentSet constituentset = associated_material.as(); if (settings_.get().value ? constituentset.MaterialConstituents().value().size() >= 1 : constituentset.MaterialConstituents().value().size() == 1) { IfcSchema::IfcMaterialConstituent constituent = constituentset.MaterialConstituents().value().front(); if (auto m_ = constituent.Material()) { @@ -469,12 +469,10 @@ namespace { // Only in case of 2x3 or old style IfcPresentationStyleAssignment auto styles = style_assignment->Styles(); #elif defined(SCHEMA_HAS_IfcPresentationStyleAssignment) - std::vector style_assignments = si->Styles(); - for (IfcSchema::IfcPresentationStyleAssignment::list::it kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) { - IfcSchema::IfcPresentationStyleAssignment* style_assignment = *kt; - + std::vector style_assignments = si.Styles(); + for (auto& style_assignment : style_assignments) { // Only in case of 2x3 or old style IfcPresentationStyleAssignment - auto styles = style_assignment->Styles(); + auto styles = style_assignment.Styles(); #else auto styles = si.Styles(); #endif @@ -735,7 +733,7 @@ taxonomy::ptr mapping::map(const express::Base& inst) { namespace { express::Base get_RelatingObject(IfcSchema::IfcRelDecomposes& decompose) { #ifdef SCHEMA_IfcRelDecomposes_HAS_RelatingObject - return decompose->RelatingObject(); + return decompose.RelatingObject(); #else IfcSchema::IfcRelAggregates aggr = decompose.as(); if (aggr) { @@ -990,7 +988,7 @@ bool mapping::get_layerset_information(const express::Base& p, layerset_informat for (auto it = associations.begin(); it != associations.end(); ++it) { IfcSchema::IfcRelAssociatesMaterial associates_material = (*it).as(); if (associates_material) { - usage = associates_material.RelatingMaterial().as().as(); + usage = associates_material.RelatingMaterial().as(); break; } } diff --git a/src/ifcparse/IfcFile.h b/src/ifcparse/IfcFile.h index 0785bcd8f2..cb3a606c2d 100644 --- a/src/ifcparse/IfcFile.h +++ b/src/ifcparse/IfcFile.h @@ -433,17 +433,7 @@ namespace impl { template T IfcParse::impl::in_memory_file_storage::create(int id) { - express::Base inst; - // T::Class() yadaya, id or freshid() I though I changed this elsewhere already - if constexpr (std::is_same_v>, IfcParse::entity>) { - inst = new T(in_memory_attribute_storage(T::Class().attribute_count())); - } else if constexpr (std::is_same_v>, IfcParse::type_declaration>) { - inst = new T(in_memory_attribute_storage(1)); - } else { - static_assert(dependent_false_v, "Requires and entity or type declaration"); - } - inst->file_ = file; - return file->addEntity(inst)->as(); + return create(&T::declaration(), id).template as(); } #ifdef IFOPSH_WITH_ROCKSDB diff --git a/src/ifcparse/IfcHierarchyHelper.cpp b/src/ifcparse/IfcHierarchyHelper.cpp index 5119c91e81..eb43e2647d 100644 --- a/src/ifcparse/IfcHierarchyHelper.cpp +++ b/src/ifcparse/IfcHierarchyHelper.cpp @@ -66,7 +66,7 @@ typename Schema::IfcLocalPlacement IfcHierarchyHelper::addLocalPlacement double xx, double xy, double xz) { - auto local_placement = create(); + auto local_placement = create(); if (parent) { local_placement.setPlacementRelTo(parent); } @@ -76,24 +76,31 @@ typename Schema::IfcLocalPlacement IfcHierarchyHelper::addLocalPlacement template typename Schema::IfcOwnerHistory IfcHierarchyHelper::addOwnerHistory() { - typename Schema::IfcPerson person = create(); - person.setIdentification(""); + typename Schema::IfcPerson person = create(); +#ifdef HAS_SCHEMA_2x3 + if constexpr (std::is_same_v) { + person.setId(""); + } else +#endif + { + person.setIdentification(""); + } - auto organization = create(); + auto organization = create(); organization.setName("IfcOpenShell"); - auto person_and_org = create(); + auto person_and_org = create(); person_and_org.setThePerson(person); person_and_org.setTheOrganization(organization); - auto application = create(); + auto application = create(); application.setApplicationDeveloper(organization); application.setVersion(IFCOPENSHELL_VERSION); application.setApplicationFullName("IfcOpenShell"); application.setApplicationIdentifier("IfcOpenShell"); int timestamp = (int)time(0); - auto owner_hist = create(); + auto owner_hist = create(); owner_hist.setOwningUser(person_and_org); owner_hist.setOwningApplication(application); owner_hist.setChangeAction(Schema::IfcChangeActionEnum::IfcChangeAction_ADDED); @@ -109,7 +116,7 @@ template typename Schema::IfcProject IfcHierarchyHelper::addProject(typename Schema::IfcOwnerHistory owner_hist) { std::vector rep_contexts; - auto dimexp = create(); + auto dimexp = create(); dimexp.setLengthExponent(0); dimexp.setMassExponent(0); dimexp.setTimeExponent(0); @@ -118,32 +125,32 @@ typename Schema::IfcProject IfcHierarchyHelper::addProject(typename Sche dimexp.setAmountOfSubstanceExponent(0); dimexp.setLuminousIntensityExponent(0); - auto unit1 = create(); + auto unit1 = create(); unit1.setUnitType(Schema::IfcUnitEnum::IfcUnit_LENGTHUNIT); unit1.setPrefix(Schema::IfcSIPrefix::IfcSIPrefix_MILLI); unit1.setName(Schema::IfcSIUnitName::IfcSIUnitName_METRE); - auto unit2a = create(); + auto unit2a = create(); unit2a.setUnitType(Schema::IfcUnitEnum::IfcUnit_PLANEANGLEUNIT); unit2a.setName(Schema::IfcSIUnitName::IfcSIUnitName_RADIAN); - auto unit2b = create(); - auto measure = create(); + auto unit2b = create(); + auto measure = create(); measure.set_attribute_value(0, 0.01745329251); unit2b.setValueComponent(measure); unit2b.setUnitComponent(unit2a); - auto unit2 = create(); + auto unit2 = create(); unit2.setDimensions(dimexp); unit2.setUnitType(Schema::IfcUnitEnum::IfcUnit_PLANEANGLEUNIT); unit2.setName("Degrees"); unit2.setConversionFactor(unit2b); std::vector units = {unit1, unit2}; - auto unit_assignment = create(); + auto unit_assignment = create(); unit_assignment.setUnits(units); - auto project = create(); + auto project = create(); project.setGlobalId(IfcParse::IfcGlobalId()); project.setOwnerHistory(owner_hist ? owner_hist : addOwnerHistory()); project.setRepresentationContexts(rep_contexts); @@ -156,7 +163,7 @@ template void IfcHierarchyHelper::relatePlacements(typename Schema::IfcProduct parent, typename Schema::IfcProduct product) { typename Schema::IfcObjectPlacement place = product.ObjectPlacement(); if (place) { - if (auto local_place = place.as()) { + if (auto local_place = place.template as()) { if (parent.ObjectPlacement()) { if (local_place != parent.ObjectPlacement()) { local_place.setPlacementRelTo(parent.ObjectPlacement()); @@ -183,7 +190,7 @@ typename Schema::IfcSite IfcHierarchyHelper::addSite(typename Schema::If proj = addProject(owner_hist); } - auto site = create(); + auto site = create(); site.setGlobalId(IfcParse::IfcGlobalId()); site.setOwnerHistory(owner_hist); site.setObjectPlacement(addLocalPlacement()); @@ -208,7 +215,7 @@ typename Schema::IfcBuilding IfcHierarchyHelper::addBuilding(typename Sc site = addSite(typename Schema::IfcProject{}, owner_hist); } - auto building = create(); + auto building = create(); building.setGlobalId(IfcParse::IfcGlobalId()); building.setOwnerHistory(owner_hist); building.setObjectPlacement(addLocalPlacement()); @@ -236,7 +243,7 @@ typename Schema::IfcBuildingStorey IfcHierarchyHelper::addBuildingStorey building = addBuilding(typename Schema::IfcSite{}, owner_hist); } - auto storey = create(); + auto storey = create(); storey.setGlobalId(IfcParse::IfcGlobalId()); storey.setOwnerHistory(owner_hist); storey.setObjectPlacement(addLocalPlacement()); @@ -292,14 +299,14 @@ void IfcHierarchyHelper::addExtrudedPolyline(typename Schema::IfcShapeRe cartesian_points.push_back(cartesian_points.front()); } - auto line = create(); + auto line = create(); line.setPoints(cartesian_points); - auto profile = create(); + auto profile = create(); profile.setProfileType(Schema::IfcProfileTypeEnum::IfcProfileType_AREA); profile.setOuterCurve(line); - auto solid = create(); + auto solid = create(); solid.setSweptArea(profile); solid.setPosition(place2 ? place2 : addPlacement3d()); solid.setExtrudedDirection(dir ? dir : addTriplet(0, 0, 1)); @@ -315,13 +322,13 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper::addExtrud typename Schema::IfcAxis2Placement3D place2, typename Schema::IfcDirection dir, typename Schema::IfcRepresentationContext context) { - auto rep = create(); + auto rep = create(); rep.setContextOfItems(context ? context : getRepresentationContext("Model")); rep.setRepresentationIdentifier(std::string("Body")); rep.setRepresentationType(std::string("SweptSolid")); rep.setItems(std::vector{}); - auto shape = create(); + auto shape = create(); shape.setRepresentations(std::vector{rep}); addExtrudedPolyline(rep, points, h, place, place2, dir, context); @@ -355,9 +362,9 @@ void IfcHierarchyHelper::addAxis( { auto p1 = addDoublet(-l / 2., 0.); auto p2 = addDoublet(+l / 2., 0.); - std::vector pts{p1, p2}; + std::vector pts{p1, p2}; - auto poly = create(); + auto poly = create(); poly.setPoints(pts); auto items = rep.Items(); @@ -373,13 +380,13 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper::addBox(do typename Schema::IfcAxis2Placement3D place2, typename Schema::IfcDirection dir, typename Schema::IfcRepresentationContext context) { - typename Schema::IfcShapeRepresentation rep = create(); + typename Schema::IfcShapeRepresentation rep = create(); rep.setContextOfItems(context ? context : getRepresentationContext("Model")); rep.setRepresentationIdentifier(std::string("Body")); rep.setRepresentationType(std::string("SweptSolid")); rep.setItems(std::vector{}); - auto shape = create(); + auto shape = create(); shape.setRepresentations(std::vector{rep}); addBox(rep, w, d, h, place, place2, dir, context); @@ -389,19 +396,19 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper::addBox(do template typename Schema::IfcProductDefinitionShape IfcHierarchyHelper::addAxisBox( double w, double d, double h, typename Schema::IfcRepresentationContext context) { - auto body_rep = create(); + auto body_rep = create(); body_rep.setContextOfItems(context ? context : getRepresentationContext("Model")); body_rep.setRepresentationIdentifier(std::string("Body")); body_rep.setRepresentationType(std::string("SweptSolid")); body_rep.setItems(std::vector{}); - auto axis_rep = create(); + auto axis_rep = create(); axis_rep.setContextOfItems(context ? context : getRepresentationContext("Plan")); axis_rep.setRepresentationIdentifier(std::string("Axis")); axis_rep.setRepresentationType(std::string("Curve2D")); axis_rep.setItems(std::vector{}); - auto shape = create(); + auto shape = create(); shape.setRepresentations(std::vector{axis_rep, body_rep}); addBox(body_rep, w, d, h, typename Schema::IfcAxis2Placement2D{}, typename Schema::IfcAxis2Placement3D{}, typename Schema::IfcDirection{}, context); @@ -428,9 +435,9 @@ void IfcHierarchyHelper::clipRepresentation(typename Schema::IfcRepresen return; } - auto plane = create(); + auto plane = create(); plane.setPosition(place); - auto half_space = create(); + auto half_space = create(); half_space.setBaseSurface(plane); half_space.setAgreementFlag(agree); @@ -438,8 +445,8 @@ void IfcHierarchyHelper::clipRepresentation(typename Schema::IfcRepresen auto items = rep.Items(); decltype(items) new_items; for (auto& item : items) { - if (auto bop = item.as()) { - auto clip = create(); + if (auto bop = item.template as()) { + auto clip = create(); clip.setOperator(Schema::IfcBooleanOperator::IfcBooleanOperator_DIFFERENCE); clip.setFirstOperand(bop); clip.setSecondOperand(half_space); @@ -451,19 +458,19 @@ void IfcHierarchyHelper::clipRepresentation(typename Schema::IfcRepresen template typename Schema::IfcSurfaceStyle getSurfaceStyle(IfcHierarchyHelper& file, double r, double g, double b, double a = 1.0) { - auto colour = file.create(); + auto colour = file.template create(); colour.setRed(r); colour.setGreen(g); colour.setBlue(b); - auto rendering = file.create(); + auto rendering = file.template create(); rendering.setSurfaceColour(colour); if (a != 1.0) { rendering.setTransparency(1.0 - a); } rendering.setReflectanceMethod(Schema::IfcReflectanceMethodEnum::IfcReflectanceMethod_FLAT); - auto surface_style = file.create(); + auto surface_style = file.template create(); surface_style.setSide(Schema::IfcSurfaceSide::IfcSurfaceSide_BOTH); surface_style.setStyles(std::vector{rendering}); @@ -473,7 +480,7 @@ typename Schema::IfcSurfaceStyle getSurfaceStyle(IfcHierarchyHelper& fil template typename Schema::IfcPresentationStyleAssignment addStyleAssignment_2x3(IfcHierarchyHelper& file, double r, double g, double b, double a = 1.0) { auto surface_style = getSurfaceStyle(file, r, g, b, a); - auto style_assignment = file.create(); + auto style_assignment = file.template create(); style_assignment.setStyles(std::vector{surface_style}); return style_assignment; } @@ -513,7 +520,7 @@ typename Schema::IfcPresentationStyle setSurfaceColour_4x3(IfcHierarchyHelper void setSurfaceColour_2x3(IfcHierarchyHelper& file, typename Schema::IfcProductRepresentation shape, typename Schema::IfcPresentationStyleAssignment style_assignment) { - auto reps = shape->Representations(); + auto reps = shape.Representations(); for (auto& rep : reps) { setSurfaceColour_2x3(file, rep, style_assignment); } @@ -927,7 +934,7 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper::addMapped if (maps.size() == 1) { map = maps.front(); } else { - map = create(); + map = create(); map.setMappingOrigin(addPlacement3d()); map.setMappedRepresentation(rep); } @@ -938,14 +945,14 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper::addMapped } if (!transform) { - transform = create(); + transform = create(); transform.setLocalOrigin(addTriplet(0, 0, 0)); } - auto item = create(); + auto item = create(); item.setMappingSource(map); item.setMappingTarget(transform); - auto new_rep = create(); + auto new_rep = create(); new_rep.setContextOfItems(rep.ContextOfItems()); new_rep.setRepresentationType(std::string("MappedRepresentation")); new_rep.setItems(std::vector{item}); @@ -957,7 +964,7 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper::addMapped representations.push_back(new_rep); if (!def) { - def = create(); + def = create(); def.setRepresentations(representations); } else { def.setRepresentations(representations); @@ -980,11 +987,11 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper::addMapped template typename Schema::IfcShapeRepresentation IfcHierarchyHelper::addEmptyRepresentation(const std::string& repid, const std::string& reptype) { - auto shape_rep = create(); + auto shape_rep = create(); shape_rep.setContextOfItems(getRepresentationContext(reptype == "Curve2D" ? "Plan" : "Model")); shape_rep.setRepresentationIdentifier(repid); shape_rep.setRepresentationType(reptype); - shape_rep.setItems(std::vector{}); + shape_rep.setItems(std::vector{}); addEntity(shape_rep); return shape_rep; } @@ -1017,7 +1024,7 @@ typename Schema::IfcGeometricRepresentationContext IfcHierarchyHelper::g project = addProject(); } auto project_contexts = project.RepresentationContexts(); - auto context = create(); + auto context = create(); context.setContextIdentifier(s); context.setCoordinateSpaceDimension(3); context.setPrecision(1.e-5); @@ -1046,7 +1053,7 @@ typename Schema::IfcGeometricRepresentationSubContext IfcHierarchyHelper if (!rep_subcontext) { // didn't find the subcontext, create it - rep_subcontext = create(); + rep_subcontext = create(); rep_subcontext.setContextIdentifier(ident); rep_subcontext.setContextType(type); rep_subcontext.setParentContext(geometric_representation_context); diff --git a/src/ifcparse/IfcHierarchyHelper.h b/src/ifcparse/IfcHierarchyHelper.h index a1e74bbba0..2ae59cb300 100644 --- a/src/ifcparse/IfcHierarchyHelper.h +++ b/src/ifcparse/IfcHierarchyHelper.h @@ -426,7 +426,7 @@ class IFC_PARSE_API IfcHierarchyHelper : public IfcParse::IfcFile { if (!owner_hist) { owner_hist = addOwnerHistory(); } - std::vector related_objects = {related_object.template as()}; + std::vector related_objects = {related_object.template as()}; auto t = create(); t.setGlobalId(IfcParse::IfcGlobalId()); t.setOwnerHistory(owner_hist); diff --git a/src/ifcparse/IfcLogger.cpp b/src/ifcparse/IfcLogger.cpp index efa66f8f4c..546c381887 100644 --- a/src/ifcparse/IfcLogger.cpp +++ b/src/ifcparse/IfcLogger.cpp @@ -34,7 +34,7 @@ #include #include -static my_thread_local express::Base current_product_; +static thread_local express::Base current_product_; namespace { diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index c2a4fd6620..2e617fbc1c 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -2447,14 +2447,14 @@ std::vector IfcFile::getInverse(int instance_id, const IfcParse for (auto it = lower; it != upper; ++it) { for (auto& i : it->second) { - return_value.push_back(instance_by_id(i).as()); + return_value.push_back(instance_by_id(i).template as()); } } } else { auto it = x.byref_excl_.find({ instance_id, ent->index_in_schema(), attribute_index }); if (it != x.byref_excl_.end()) { for (auto& i : it->second) { - return_value.push_back(instance_by_id(i).as()); + return_value.push_back(instance_by_id(i).template as()); } } } diff --git a/src/ifcparse/IfcParse.h b/src/ifcparse/IfcParse.h index b6efdc9501..a0f0569dd4 100644 --- a/src/ifcparse/IfcParse.h +++ b/src/ifcparse/IfcParse.h @@ -114,7 +114,7 @@ class IFC_PARSE_API IfcSpfLexer { public: std::string& GetTempString() const { - static my_thread_local std::string string; + static thread_local std::string string; return string; } FileReader* stream; diff --git a/src/ifcparse/IfcSchema.h b/src/ifcparse/IfcSchema.h index 40dc00af8b..46d1469a08 100644 --- a/src/ifcparse/IfcSchema.h +++ b/src/ifcparse/IfcSchema.h @@ -141,7 +141,7 @@ class IFC_PARSE_API declaration { mutable const schema_definition* schema_; std::string& temp_string_() const { - static my_thread_local std::string string; + static thread_local std::string string; return string; } @@ -457,7 +457,7 @@ class IFC_PARSE_API schema_definition { }; std::string& temp_string_() const { - static my_thread_local std::string string; + static thread_local std::string string; return string; } diff --git a/src/ifcparse/express.h b/src/ifcparse/express.h index 021c6a7eaa..f327241f00 100644 --- a/src/ifcparse/express.h +++ b/src/ifcparse/express.h @@ -113,7 +113,7 @@ class IFC_PARSE_API Base { return T{}; } } else if constexpr (std::is_same_v) { - static_assert(false, "Select is abstract"); + static_assert(std::is_same_v, "Select is abstract"); } else { if (declaration().is(T::Class())) { return T(data_weak()); @@ -189,14 +189,14 @@ template std::vector cast_vector(const std::vector& vs) { std::vector result; for (const auto& v : vs) { - if constexpr (std::is_base_of_v || std::is_same_v) { + if constexpr (std::is_base_of_v) { // For a base or identity transform we can just rely on static cast result.push_back(v); } else if constexpr (std::is_base_of_v && std::is_same_v) { // From a select to concrete we simply call the appropriate method result.push_back(v.concrete()); } else { - if (auto u = v.as()) { + if (auto u = v.template as()) { result.push_back(u); } } diff --git a/src/ifcparse/ifc_parse_api.h b/src/ifcparse/ifc_parse_api.h index 875f5b7775..d4aa823fda 100644 --- a/src/ifcparse/ifc_parse_api.h +++ b/src/ifcparse/ifc_parse_api.h @@ -34,17 +34,4 @@ #define IFC_PARSE_API #endif -#if defined(__clang__) -#define my_thread_local thread_local -#elif defined(__GNUC__) -#define my_thread_local __thread -#elif __STDC_VERSION__ >= 201112L -#define my_thread_local _Thread_local -#elif defined(_MSC_VER) -#define my_thread_local __declspec(thread) -#elif defined(SWIG) -#else -#error Cannot define thread_local -#endif - #endif