如何从 C++ 中的两个向量生成所有可能的对?

How to generate all possible pairs from two vectors in C++?

我有两个向量:

vector<double>vec1={1, 2, 3, 4, 5}
vector<double>vec2={6, 7, 8, 9, 10}

我想生成所有可能的对,例如:

{1,6}, {1,7}, {1,8}, {1,9}, {1, 10}, {2,6}, {2, 7}...
#include <vector>
#include <iostream>

int main()
{
        std::vector<int> a = {1,2,3,4,5};
        std::vector<int> b = {1,2,3,4,5};

        for(int i =0;i<a.size() ;i++)
             for(int j =0;j<a.size() ;j++)
                  std::cout << "{"<< a[i] << "," << b[j] << "} ";

}