need some kind of operator.. c++

后端 未结 6 1703
我寻月下人不归
我寻月下人不归 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:40

    Qt containers work exactly like this:

    QStringList list;
    list << "Sven" << "Kim" << "Ola";
    
    QVector vect = list.toVector();
    // vect: ["Sven", "Kim", "Ola"]
    

    If you want the same to work with STL containers, you would need to write the operator overloading yourself but obviously you can't add operations to std namespace.

提交回复
热议问题