I'm creating a program where I input a vector into a function in order to assign random values to all of the elements inside the vector. However I'm getting an error when I simply try to declare the function prototype. When I do:
1 2 3 4 5 6 7 8 9
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <vector>
usingnamespace std;
void RandomArray_Fill(std::vector& vec); // creates a reference for the vector
I get the error:
argument list for class template "std::vector" is missing
Could you give me some tips on what I'm doing wrong with declaring this function?
The std::vector is a template class so you need to specify what it will contain:
1 2 3 4 5 6 7
// If you want a vector of integers:
void RandomArray_Fill(std::vector<int>& vec);
// If you want a vector of strings:
void RandomArray_Fill(std::vector<std::string>& vec);
// etc...