mercredi 25 octobre 2017

operator= for bitset (from C++ to C++11)

this worked in VS6

std::bitset<8> cmd;
unsigned char c;
cmd = c; 

in VS2015 I get this error:Error C2679 binary '=' : no operator found which takes a right-hand operand of type 'UINT' (or there is no acceptable conversion)

How can i assign a char to bitset?

Do I have now to iterate trough all bits of c and set the bits with std::bitset& set (size_t pos, bool val = true);

Aucun commentaire:

Enregistrer un commentaire