need some kind of operator.. c++

后端 未结 6 1689
我寻月下人不归
我寻月下人不归 2021-01-13 22:06

I want to store a sequence of string in a queue. This seems pretty simple if i use the member function push()

queue test;
string s0(\"s0\"), s1(         


        
6条回答
  •  时光取名叫无心
    2021-01-13 22:44

    If you wanted to do this it would typically be expressed as

    test << s0 << s1 << s2 << s3;
    

    by suitable definition of overloaded operator<< on the queue class. I don't know why this would be better than a simple series of test.push() calls though.

提交回复
热议问题