how to append a list object to another

前端 未结 2 511
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-29 23:06

in C++, I have two list objects A and B and I want to add all the members of B to the end of A. I\'ve s

2条回答
  •  不思量自难忘°
    2021-01-29 23:51

    one example using boost

    std::list A; // object A is a list containing T structure
    std::list B; // object B is a list containing T structure
    
    // append list B to list A
    BOOST_FOREACH(auto &listElement, B) { A.push_back( listElement ); }
    

提交回复
热议问题