📜  连接两个向量 c++ 代码示例

📅  最后修改于: 2022-03-11 14:44:58.078000             🧑  作者: Mango

代码示例1
#include  // vector 
#include  // output 
using namespace std;

int main()
{
  // two vectors to concatenate
  vector A = {1,3,5,7};
  vector B = {2,4,6,8};
  // vector that will hold the combined values of A and B
  std::vector AB = A;
  AB.insert(AB.end(), B.begin(), B.end());
  // output 
  for (auto i : AB) {
      cout << i << ' ';
  }
}