Copy all the values of a map to another

#include <iostream>
#include <map>

int main() {
    // Create a map with key-value pairs
    std::map<int, std::string> sourceMap = {
        {1, "One"},
        {2, "Two"},
        {3, "Three"}
    };

    // Create an empty map to copy values into
    std::map<int, std::string> targetMap;

    // Iterate through the source map
    for (const auto& pair : sourceMap) {
        // Insert each key-value pair into the target map
        targetMap.insert(pair);
    }

    // Display the contents of the target map
    for (const auto& pair : targetMap) {
        std::cout << "Key: " << pair.first << ", Value: " << pair.second << std::endl;
    }

    return 0;
}