In the code below, the size of the function (foo) argument (std::vector) can be anything to make the function a generic one. However, sometimes the size container is known so std::array can be used. The problem is to convert the std::array to std::vector. What is the best way to solve this problem? Is it better to just use std::vector always in this case?
#include <iostream>
#include <array>
#include <vector>
using namespace std;
// generic function: size of the container can be anything
void foo (vector<int>& vec)
{
    // do something
}
int main()
{
   array<int,3> arr; // size is known. why use std::vector?
   foo (arr); // cannot convert std::array to std::vector
   return 0;
}



foomodifies the vector since it takes by mutable reference, is that correct? That's going to be very relevant to the answer.void foo(RangeOf<int>&);and it'll take any kind of range ofints.beginandenditerators. That way it doesn't care which container you use.// size is known. why use std::vector?-- why not usestd::vector?