Return deque-array c++

896 views Asked by At

How do I return an deque array in c++?

private:
   deque<int> iHouses[3];

public:
   deque<int> getHouses();

//gives me an error when implementing the function of course - but where should I put the brackets?

 deque<int> GameEngine::getHouses() {
    return this->iHouses;
}
1

There are 1 answers

0
schorsch_76 On BEST ANSWER

Just use the std::array

#include <array>
    ....
private:
    using my_house_cont = std::array<std::deque<int>, 3>;
    my_house_cont m_houses;

public:
    my_house_cont getHouses();