You could use one array of offset for the odd pos and another for the normal one:
const sf::Vector2i oddOffset[] = {
{-1, 0},
{-1, -1}, {-1, 1},
{-2, 0}, {2, 0},
{1, -1}, {1, 1},
{1, 0}
}
const sf::Vector2i normalOffset[] = {
{0, 0},
{0, -1}, {0, 1},
{-2, 0}, {2, 0},
{1, -1}, {1, 1},
{1, 0}
}
const bool isOdd = mapTile->getPositionOnMap().y & 1;
for(const auto& pos : isOdd ? oddOffset : normalOffset)
{
int checkX = mapTile->getPositionOnMap().x + pos.x;
int checkY = mapTile->getPositionOnMap().y + pos.y;
if (checkX >= 0 && checkX < mWidth && checkY >= 0 && checkY < mHeight)
{
neighbours.push_back(&mMap[checkY][checkX]);
}
}