It's likely a good idea to contain the vertex array within another class. The class would be the "drawable object" and the vertex array would be its "visible representation."
This is how SFML shapes (and many other drawables) do it; the SFML shapes store a vertex array within its class. They also inherit from both sf::Drawable (so it can have the draw method) and sf::Transformable - as FRex mentioned - (so the entire shape can be transformed (moved/rotated/scaled)) at once without having to make those calculations. In fact, the transformation calculations are done on the graphics card when doing it this way so it's worth learning about this method.
The usual form of a drawable would be something like:
class DrawableName : public sf::Drawable, public sf::Transformable
{
public:
DrawableName();
private:
sf::VertexArray m_vertices;
void draw(sf::RenderTarget& target, sf::RenderStates states) const;
}
// this is the constructor
DrawableName::DrawableName()
: m_vertices(6u)
{
}
// this is the draw method that can be called later like this: window.draw(drawableName);
void DrawableName::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
states.transform = getTransform();
target.draw(m_vertices, states);
}
You can, of course, add other methods as you like to control things like size and colours or any other vertex manipulation.
Note that since the class inherits from sf::Transformable, you can also use the setPosition(), setScale(), setRotation(), move(), scale(), rotate() methods to manipulate the entire shape. Of course, getPosition, getScale and getRotation is also provided.
Slightly more advanced:
instead of using a vertex array, you can instead use an std::vector of sf::Vertex i.e.:
std::vector<sf::Vertex> m_vertices
To draw it then, you would need something like:
target.draw(m_vertices.data(), m_vertices.size(), sf::PrimitiveType::Triangles, states);
Note here that you must specify the primitive type but you can choose to store it separately as a member of the class, somewhere in the cpp file, or express it directly as in this example.
Note that if you use SFML 3, the draw method needs the sf::RenderStates to be passed as a reference, not as a copy.