When passing a bool vector to my construct and when doing get it does not return the original vector

I am testing my Solution class, which is as follows:

class Solution {
public:
    /**
     * @brief Constructor for Solution.
     *
     * @param cost The cost of the solution.
     * @param y Vector indicating if there is a warehouse at site i (1 or 0).
     * @param x Matrix indicating if customer j is served by warehouse i (1 or 0).
     */
    Solution(double cost, vector<bool>& y, vector<vector<int>>& x);

    /**
     * @brief Gets the cost of the solution.
     *
     * @return double The cost of the solution.
     */
    double getCost() ;

    /**
     * @brief Sets the cost of the solution.
     *
     * @param cost The new cost of the solution.
     */
    void setCost(double cost);

    /**
     * @brief Gets the warehouse assignment vector.
     *
     * @return vector<uint8_t>& The warehouse assignment vector.
     */
    vector<bool>& getY() ;

    /**
     * @brief Sets the warehouse assignment vector.
     *
     * @param y The new warehouse assignment vector.
     */
    void setY(vector<bool>& y);

    /**
     * @brief Gets the customer assignment matrix.
     *
     * @return vector<vector<uint8_t>>& The customer assignment matrix.
     */
    vector<vector<int>>& getX() ;

    /**
     * @brief Sets the customer assignment matrix.
     *
     * @param x The new customer assignment matrix.
     */
    void setX(vector<vector<int>>& x);

    /**
     * @brief Compares two solutions.


     *
     * @param other Another instance of Solution to compare.
     * @return true If the solutions are equal.
     * @return false If the solutions are different.
     */
    bool operator==(Solution& other) ;

    /**
     * @brief Calculate the cost of the solution given an instance.
     *
     * @param instance The instance for which to calculate the solution cost.
     */
    void calculateCost(Instance& instance);

    /**
     * @brief Converts the solution to a string representation.
     *
     * @return string The string representation of the solution.
     */
    string toString() ;

    /**
     * @brief Checks if the solution is feasible.
     *
     * @param instance The instance to check the solution against.
     * @return true If the solution is feasible.
     * @return false If the solution is not feasible.
     */
    bool isFeasible(Instance& instance);

private:
    /**
     * @brief Calculates the total demand of customers.
     *
     * @param instance The instance to calculate the demand from.
     * @return int The total demand.
     */
    int calculateTotalDemand(Instance& instance);

    double cost;                         ///< The cost of the solution.
    vector<bool>& y;              ///< Warehouse assignment vector.
    vector<vector<int>>& x; ///< Customer assignment matrix.
    int totalDemand;                     ///< Total demand of customers.
    bool demandCalculated;               ///< Flag to check if the total demand has been calculated.
};

#endif // SOLUTION_H

The implementation of the class is as follows (I will omit the methods that are not important)

Solution::Solution(double cost, vector<bool>& y, vector<vector<int>>& x)
    : cost(cost), y(y), x(x), totalDemand(0), demandCalculated(false) {}

vector<bool>& Solution::getY() {
    return this->y;
}

void Solution::setY(vector<bool>& y) {
    this->y = y;
}

the test that fails is getY()

namespace {
    int randomInt(int min, int max) {
        static std::mt19937 rng(std::random_device{}());
        std::uniform_int_distribution<int> dist(min, max);
        return dist(rng);
    }

    double randomDouble(double min, double max) {
        static std::mt19937 rng(std::random_device{}());
        std::uniform_real_distribution<double> dist(min, max);
        return dist(rng);
    }

    Instance createRandomInstance() {
        int numFacilities = randomInt(5, 10);
        int numCustomers = randomInt(5, 10);

        vector<int> facilityCapacities(numFacilities);
        vector<double> openingCosts(numFacilities);
        vector<int> customerDemands(numCustomers);
        vector<vector<double>> transportationCosts(numFacilities, vector<double>(numCustomers));

        for (int i = 0; i < numFacilities; ++i) {
            facilityCapacities[i] = randomInt(50, 200);
            openingCosts[i] = randomDouble(1000.0, 5000.0);
        }

        for (int j = 0; j < numCustomers; ++j) {
            customerDemands[j] = randomInt(10, 100);
            for (int i = 0; i < numFacilities; ++i) {
                transportationCosts[i][j] = randomDouble(10.0, 50.0);
            }
        }

        vector<bool> y(numFacilities);
        vector<vector<int>> x(numFacilities, vector<int>(numCustomers));

        Solution bestSolution(0.0, y, x);

        return Instance(numFacilities, numCustomers, facilityCapacities, customerDemands, openingCosts, transportationCosts, bestSolution);
    }

    Solution createRandomSolution(int numFacilities, int numCustomers) {

        vector<bool> y(numFacilities);
        vector<vector<int>> x(numFacilities, vector<int>(numCustomers));

        for (int i = 0; i < numFacilities; ++i) {
            y[i] = randomInt(0, 1);
            for (int j = 0; j < numCustomers; ++j) {
                x[i][j] = randomInt(0, 1);
            }
        }

        double cost = randomDouble(100.0, 10000.0);

        return Solution(cost, y, x);
    }

    Instance randomInstance = createRandomInstance();
    Solution randomSolution = createRandomSolution(randomInstance.getNumFacilities(), randomInstance.getNumCustomers());
}

TEST(SolutionTest, GetYTest) {
    const vector<bool>& y = randomSolution.getY();
    EXPECT_EQ(y.size(), randomInstance.getNumFacilities());
}

TEST(SolutionTest, SetYTest) {
    vector<bool> newY(randomInstance.getNumFacilities());
    for (size_t i = 0; i < newY.size(); ++i) {
        newY[i] = randomInt(0, 1);
    }
    cout << "newY: " << newY.size() << endl;
    randomSolution.setY(newY);
    cout << "randomSolution: " << randomSolution.getY().size() << endl;
    cout << "newY: " << newY.size() << endl;
    EXPECT_EQ(randomSolution.getY(), newY);
}

The createRandomSolution function properly creates the solution objects. The problem is that when invoking the getY() method, it does not return the array that was created in the function. It is even received correctly in the class constructor. The output of my test is the following:

[ RUN      ] SolutionTest.GetYTest
y.size()
    Which is: 1124207380080384
  randomInstance.getNumFacilities()
    Which is: 7

[ RUN      ] SolutionTest.SetYTest
Expected equality of these values:
  randomSolution.getY()
    Which is: { false, false, false, false, false, false, false, false, true, false, false, false, true, true, true, false, false, false, false, true, true, false, true, false, false, true, true, true, false, true, false, true, ... }
  newY
    Which is: { false, true, true, true, false, true, false }

I have no idea where the problem comes from, I hope you can guide me to solve the problem.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật