I'm new to cpp as from today, moved from matlab to run simulations faster.
I would like to build a function that receives a vector and returns vectors that contain the indexes of a given value and the number of appearance.
for example, if I have:
A={0 , 1, 1, 1,  0};
I would like to get
vec1={0, 4}; // 0
a=2;
vec2=(1,2,3); // 1
b=3;
so far I have:
# include <iostream>
# include <string>
# include <vector>
using namespace std;
const int nTot = 10;
void get_index(vector<int> FVec, vector<int> &vec1, vector<int> &vec2)
{
    for (unsigned int i=0; i < FVec.size(); i++)
    {
        if (FVec[i] == 0)
        {
            vec1.push_back(i);
        }
        if (FVec[i] == 1)
        { 
            vec2.push_back(i);
        }
    }
}
int main()
{
    int nf = nTot/2;
    vector<int> FVec(nf);
    vector<int> vec1;
    vector<int> vec2;
    get_index(FVec,vec1,vec2);
    system (" pause");
    return 0;
}
The problem here now is that it does not change the vectors, probably due to the assignment in the function
 
    