bitset - STL C++

bitset<N>:::operator^=()

Declaration

bitset<N>& bitset<N>::operator^=(const bitset<N>& kqrRightSide);

Description

This is the member function operator^=() for the bitset class template. This function performs a bitwise exclusive-or on the bitsets and stores the result in the left-hand side bitset.

Header Include

#include <bitset>

Example

#include <bitset>
#include <iostream>

int main()
{
	using namespace std;

	// Create two bitsets
	bitset<4> qBits1(5);
	bitset<4> qBits2(3);
	cout << "bitset<4> #1: "<< qBits1 << endl;
	cout << "bitset<4> #2: "<< qBits2 << endl;

	// Take the bitwise exclusive-or of the two bitsets
	cout << qBits1 << " ^ " << qBits2 << " = ";
	qBits1 ^= qBits2;
	cout << qBits1 << endl;

	// Keep the window open
	cin.get();
	return 0;
}

Output

bitset<N>::operator^=() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.