返回deque-array c ++

时间:2015-06-16 10:50:49

标签: c++ deque arraydeque

如何在c ++中返回deque数组?

private:
   deque<int> iHouses[3];

public:
   deque<int> getHouses();

//在实现函数时给我一个错误 - 但是我应该在哪里放括号?

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

1 个答案:

答案 0 :(得分:4)

只需使用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();