How to create a vector function?

May 19, 2016 at 3:17am
Hello, so I am having trouble creating a vector function. The function is suppose to take 2 vectors as its parameter and return a vector

I thought the format would be:

vector vector_name(vector<int>V1, vector<int>V2)
{ //code
}

I tried it, but it then says that it is missing an argument list. So I'm just confused.
May 19, 2016 at 4:53am
1
2
3
std::vector<int> function(const std::vector<int> &v1, const std::vector<int> &v2){
    //...
}

You can't omit the <T> part.
Last edited on May 19, 2016 at 4:53am
Topic archived. No new replies allowed.