Converting vector of TopoDS_Solid to vector of TopoDS_Shape in OpenCASCADE

OCCUtils provides Shapes::FromSolids  to convert a std::vector<TopoDS_Solid> to a std::vector<TopoDS_Shape> in OpenCASCADE:

#include <occutils/Shape.hxx>

using namespace OCCUtils;

std::vector<TopoDS_Solid> solids = /* ... */;
std::vector<TopoDS_Shape> shapes = Shapes::FromSolids(solids);

In case you need to do it manually without using OCCUtils, use this snippet:

#include <algorithm>

// Create return vector
std::vector<TopoDS_Shape> shapes;
shapes.reserve(solids.size());
// Do the copying
std::copy(solids.begin(), solids.end(), std::back_inserter(shapes));