I would say that it's more reliable to use the view rather than the size of the window since the view is the actual co-ordinates used for the positioning.
And, since you want the centre and the view knows what its centre is, you can just get that:
sprite.setPosition(view.getCenter());
Or, if you don't have a separate view, you can get the view from the window:
sprite.setPosition(window.getView().getCenter());
Remember, though, that the top-left corner of the sprite will be placed in the centre of the window unless you alter the sprite's origin. You probably want it to be in its centre:
sprite.setOrigin(sf::Vector2f(sprite.getTexture().getSize() / 2u));