Lets see the code snippet for the function and we can help.
Hey thanks, i define th vecotr in the .h: //bit vector to store the errror corrected link control word bit_vector decoded_lcw_vec; i fill th vector like this: bit_vector decoded_lcw_vec(corrected_array, corrected_array + sizeof corrected_array / sizeof corrected_array[0]) ; and I can see the right values are there using cout. i have a function to return the vector: const_bit_vector& ldu1::get_vec() const { return decoded_lcw_vec; } and then I use the that funtion as the arguement in extract: uint16_t ldu1::lcf() const { const size_t LCF_BITS[] = { 0, 1, 2, 3, 4, 5, 6 , 7 }; const size_t LCF_BITS_SZ = sizeof(LCF_BITS) / sizeof(LCF_BITS[0]); const uint16_t lcf = extract(get_vec(), LCF_BITS, LCF_BITS_SZ); return lcf; } Thanks!