Return 双端队列 C++
Return deque-array c++
如何在 C++ 中 return 双端队列数组?
private:
deque<int> iHouses[3];
public:
deque<int> getHouses();
//当然在实现功能时给我一个错误 - 但是我应该把括号放在哪里?
deque<int> GameEngine::getHouses() {
return this->iHouses;
}
只需使用 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();
如何在 C++ 中 return 双端队列数组?
private:
deque<int> iHouses[3];
public:
deque<int> getHouses();
//当然在实现功能时给我一个错误 - 但是我应该把括号放在哪里?
deque<int> GameEngine::getHouses() {
return this->iHouses;
}
只需使用 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();