⎗ ✓ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23#include <iostream> #include <vector> #include <algorithm> struct Dummy { char x; int y; }; int main() { std::vector<int> a = {1, 2, 3, 4, 5}; std::vector<Dummy> b(5); std::transform(b.begin(), b.end(), a.begin(), a.begin(), [](Dummy& c, int d) { c.y = d; return d; }); for (auto& i : b) { std::cout << "{" << i.x << "; " << i.y << "} " ; } std::cout << std::endl; }