fix: step_import — use find/insert_or_assign for unordered_map of non-default-constructible types
This commit is contained in:
@@ -1225,7 +1225,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
curves::NurbsCurve get_or_build_curve(int ref) {
|
curves::NurbsCurve get_or_build_curve(int ref) {
|
||||||
if (curve_cache_.count(ref)) return curve_cache_[ref];
|
auto cit = curve_cache_.find(ref);
|
||||||
|
if (cit != curve_cache_.end()) return cit->second;
|
||||||
if (!entities_.count(ref)) {
|
if (!entities_.count(ref)) {
|
||||||
// Return a dummy curve
|
// Return a dummy curve
|
||||||
return curves::NurbsCurve({Point3D(0,0,0), Point3D(1,0,0)}, {0,0,1,1}, {1,1}, 1);
|
return curves::NurbsCurve({Point3D(0,0,0), Point3D(1,0,0)}, {0,0,1,1}, {1,1}, 1);
|
||||||
@@ -1251,12 +1252,13 @@ private:
|
|||||||
set_error(StepError::EntityTypeError, "Error building curve #" + std::to_string(ref) + ": " + e.what());
|
set_error(StepError::EntityTypeError, "Error building curve #" + std::to_string(ref) + ": " + e.what());
|
||||||
nc = curves::NurbsCurve({Point3D(0,0,0), Point3D(1,0,0)}, {0,0,1,1}, {1,1}, 1);
|
nc = curves::NurbsCurve({Point3D(0,0,0), Point3D(1,0,0)}, {0,0,1,1}, {1,1}, 1);
|
||||||
}
|
}
|
||||||
curve_cache_[ref] = nc;
|
curve_cache_.insert_or_assign(ref, nc);
|
||||||
return nc;
|
return nc;
|
||||||
}
|
}
|
||||||
|
|
||||||
curves::NurbsSurface get_or_build_surface(int ref) {
|
curves::NurbsSurface get_or_build_surface(int ref) {
|
||||||
if (surface_cache_.count(ref)) return surface_cache_[ref];
|
auto sit = surface_cache_.find(ref);
|
||||||
|
if (sit != surface_cache_.end()) return sit->second;
|
||||||
if (!entities_.count(ref)) {
|
if (!entities_.count(ref)) {
|
||||||
// Return a dummy surface
|
// Return a dummy surface
|
||||||
std::vector<std::vector<Point3D>> g = {{Point3D(0,0,0), Point3D(1,0,0)},
|
std::vector<std::vector<Point3D>> g = {{Point3D(0,0,0), Point3D(1,0,0)},
|
||||||
@@ -1293,7 +1295,7 @@ private:
|
|||||||
{Point3D(0,1,0), Point3D(1,1,0)}};
|
{Point3D(0,1,0), Point3D(1,1,0)}};
|
||||||
ns = curves::NurbsSurface(g, {0,0,1,1}, {0,0,1,1}, {}, 1, 1);
|
ns = curves::NurbsSurface(g, {0,0,1,1}, {0,0,1,1}, {}, 1, 1);
|
||||||
}
|
}
|
||||||
surface_cache_[ref] = ns;
|
surface_cache_.insert_or_assign(ref, ns);
|
||||||
return ns;
|
return ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user