c++ copy with transform

#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    // Source container
    std::vector<int> source = {1, 2, 3, 4, 5};

    // Destination container
    std::vector<int> destination;

    // Copy elements from source to destination using transform
    std::transform(source.begin(), source.end(), std::back_inserter(destination),
                   [](int element) { return element * 2; });

    // Display the contents of the destination container
    std::cout << "Destination container after transformation: ";
    for (const auto &element : destination) {
        std::cout << element << " ";
    }

    return 0;
}