input vectors outside of main function c++

  c++, matrix, vector

I am trying to get an input to a matrix by placing the whole thing as in a function outside of main (), as follows:

    void input_matrix(int row, int col){
std::vector<std::vector<int>> matrix;
  for (int m=0; m<row; m++){
    for (int n=0; n<col; n++){
      std::cin >> matrix[m][n];
  return matrix;

somehow the compiler doesn’t like me inputing the matrix here, any solutions?

Source: Windows Questions C++