64,681
社区成员
发帖
与我相关
我的任务
分享
struct A
{
int a;
};
vector<A> vecA;
struct B
{
int b;
};
vector<B> vecB;
struct C
{
int c1;
int c2;
};
vector<C> vecC;
C fun(A a,B b)
{
C tmp;
tmp.c1 = a.a;
tmp.c2 = b.b;
return tmp;
};
int main()
{
std::vector<A> vecA(10);
std::vector<B> vecB(10);//元素个数都是10;
std::vector<C> vecC;
vecC.resize(10);
std::transform(vecA.begin(),vecA.end(),vecB.begin(),vecC.begin(),fun);
system("pause");
return 0;
}