I don't think you are asking the right question. What you asked was how do you use the function and here is how:
typedef std::vector<int> vecint;
typedef std::vector<vecint> vecvecint;
int first=2;
int rows=3;
int cols=3;
vecvecint vvi = transmult( first, rows, cols );