I have created overloading << operator as a global function, which prints vector of uint8_t in hexadecimal representation.
1 2 3 4 5 6 7 8 9 10
ostream & operator<<(ostream& str, const vector<uint8_t> &k) {
cout.setf(ios::hex, ios::basefield); // set hex as the basefield
for (uint i = 0; i < k.size(); i++)
str << (uint) k[i];
cout.setf(ios::dec, ios::basefield); // set default dec basefield
return str;
}
Everything works correctly in main(), but if i try to use it inside the class it doesn't change the decimal to hexadecimal representation.