Sketcher-Utils: vector of smart pointers to vector of pointers

This commit is contained in:
Abdullah Tahiri
2022-05-18 12:49:50 +02:00
parent bae8050fac
commit 3cd34e1c38

View File

@@ -124,5 +124,15 @@ void removeRedundantHorizontalVertical(Sketcher::SketchObject* psketch,
void ConstraintToAttachment(Sketcher::GeoElementId element, Sketcher::GeoElementId attachment, double distance, App::DocumentObject* obj);
}
template <typename T>
auto toPointerVector(const std::vector<std::unique_ptr<T>> & vector) {
std::vector<T *> vp (vector.size());
std::transform(vector.begin(), vector.end(), vp.begin(), [](auto &p) {return p.get();});
return vp;
}
#endif // SKETCHERGUI_Recompute_H