Concatenating two std::vectors

后端 未结 25 2610
予麋鹿
予麋鹿 2020-11-22 12:00

How do I concatenate two std::vectors?

25条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 12:13

    Try, create two vectors and add second vector to first vector, code:

    std::vector v1{1,2,3};
    std::vector v2{4,5};
    
    for(int i = 0; i

    v1:1,2,3.

    Description:

    While i int not v2 size, push back element , index i in v1 vector.

提交回复
热议问题