bool bitset<N>::reference::operator~();
#include <bitset>
#include <bitset>
#include <iostream>
int main()
{
using namespace std;
// Create a bitset of four bits with the 2nd one "on"
bitset<4> qBits(2);
cout << "bitset<4> : "<< qBits << endl;
// Negate the fourth bit
bool bNegFourthBit = ~(qBits[3]);
cout << "The negation of " << qBits[3] << " is " << bNegFourthBit << endl;
// Keep the window open
cin.get();
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.