mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
ifcgeom: add a profile_point overload taking a plain double
The profile mapping builds its points as
profile_helper(m4, {
{{-x, -y}, {f2}},
...
where `f2` is a `double` and profile_point's second member is a
`boost::optional<double>`. In recent Boost (somewhere between 1.85 and 1.91)
optional's converting constructor became explicit, and an explicit constructor
cannot be used in copy-initialization — which is what a braced element is. So
every one of these call sites stops compiling:
MSVC 19.4x: error C2664: cannot convert argument 2 from
'initializer list' to 'const std::vector<profile_point>&'
clang-cl 22: error: chosen constructor is explicit in copy-initialization
Twelve translation units are affected (IfcCShapeProfileDef,
IfcIShapeProfileDef, IfcLShapeProfileDef, IfcTShapeProfileDef,
IfcUShapeProfileDef, IfcZShapeProfileDef, IfcAsymmetricIShapeProfileDef,
IfcCraneRailAShapeProfileDef, IfcRectangleProfileDef,
IfcRectangleHollowProfileDef, IfcRoundedRectangleProfileDef,
IfcTrapeziumProfileDef), roughly 100 call sites in total.
Adding one overload that takes the double directly fixes all of them without
touching a single call site, and changes nothing for existing code: the
optional overload still wins wherever an optional is passed.
Verified by building schemas 2x3;4;4x3_add2 with MSVC 2022 against Boost
1.91 and OCCT 7.9.3 — IfcParse, IfcGeom, the schema mappings and
geometry_kernel_opencascade all archive cleanly. Without this, the same build
against Boost 1.85 succeeds, which is what identified Boost as the variable.
This commit is contained in:
@@ -13,6 +13,14 @@ namespace ifcopenshell {
|
||||
profile_point(const std::array<double, 2>& p, const boost::optional<double>& r = boost::none)
|
||||
: xy(p), radius(r) {
|
||||
}
|
||||
|
||||
// Recent Boost makes optional's converting constructor explicit,
|
||||
// and an explicit constructor cannot be used in copy-initialization
|
||||
// - which is what `{{x, y}, {radius}}` in the profile mappings is.
|
||||
// Taking the double directly keeps every call site working.
|
||||
profile_point(const std::array<double, 2>& p, double r)
|
||||
: xy(p), radius(r) {
|
||||
}
|
||||
};
|
||||
|
||||
struct profile_point_with_edges {
|
||||
|
||||
Reference in New Issue
Block a user