Converting vector of TopoDS_Face to vector of TopoDS_Shape in OpenCASCADE

OCCUtils provides Shapes::FromFaces  to convert a std::vector<TopoDS_Face> to a std::vector<TopoDS_Shape> in OpenCASCADE:

#include <occutils/Shape.hxx>

using namespace OCCUtils;

std::vector<TopoDS_Face> faces = /* ... */;
std::vector<TopoDS_Shape> shapes = Shapes::FromFaces(faces);

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(faces.size());
// Do the copying
std::copy(faces.begin(), faces.end(), std::back_inserter(shapes));