lets say i have a function that fills an array with bits that are data payload that is for eyes when certain fields are converted hex. as we know, we can not return this array and we can not return a pointer to this array. so how can we access this data outside of the function that creates it?
could we put the contents of the array into a vector and can we return that vector??
Yes, but since you haven't posted code, I cannot give more specific help.
right right so here is the relevant code.
i got the code for this operation from this site, the part of the code that is supposed to put the bits from the array into the vector, but it does not work :
1 2 3 4 5 6 7 8 9 10 11 12
decode_rs(); // recd[] will be error corrected and in polynomial form
// put recd[]s into decoded_lcw[]
for(i=nn-kk; i < nn; i++)
{
decoded_lcw[i - (nn-kk) + index*(nn-kk)] = recd[i];
}
}
//put values of decoded_lcw[] into decoded_lcw_vec()
decoded_lcw_vec( decoded_lcw, decoded_lcw + sizeof(decoded_lcw)/sizeof(decoded_lcw[0]) ) ;
delete [] decoded_lcw;
}
throws this error:
error: no match for call to '(bit_vector {aka std::vector<bool>}) (uint16_t*&, uint16_t*)'
declared the vector in the header like this:
1 2
//bit vector containing the decoded link control word
bit_vector decoded_lcw_vec;
and this is how i was thinking to return the vector: