copying a std::vector to a qvector

后端 未结 4 1212
囚心锁ツ
囚心锁ツ 2021-02-20 04:40

I tried copy content of one vector to a QVector using the following

std::copy(source.begin(), source.end(), dest.begin());

However

4条回答
  •  感情败类
    2021-02-20 05:37

    'fromStdVector' has been explicitly marked deprecated recently. Use following code:

    std::vector<...> stdVec;
    
    // ...       
    
    QVector<...> qVec = QVector<...>(stdVec.begin(), stdVec.end());
    

提交回复
热议问题