相关文章推荐
善良的牛肉面  ·  聊聊编程范式- 知乎·  2 年前    · 
善良的牛肉面  ·  前端编程范式- 掘金·  2 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I need to construct a crawler working with front_queues and back_queues , which are vectors of queues. I've seen solutions in this question Vector of queues but my compiler complains the vec needs a constructor.

#include <vector>
#include <queue>
using namespace std;
vector<queue<int> > vec;
vec.push_back( queue<int>(0) );
// error: expected constructor, destructor, or type conversion before ‘.’ token

queuedoesn't have initializer list :

According to queue's constructor reference (Source), you can't use queue<int>(0) because no proper constructor would match. However, you can use queue<int>(). It will create an empty queue. Take a look at this online example : https://ideone.com/RbT1pD

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.