bitset class is used for the operation on bit sets.
A bitset class is declared as:
template <size_t L> class bitset;
where, L is the length of bitset.
Types of bitset constructors:
Type-1: Empty bitset
Type-2: bitset having bits as per x.
bitset(unsigned long bits);
Type-3: bitset having string s and starting at y.
explicit bitset(const string &s, size_t y = 0, size_t n = npos);
Types of bitset operators: << and >>
Member functions used by bitset:
1) count function: It is used to return number of bits which are 1.
2) flip function: It is used to flip the bits.
3) any function: Returns true for a bit in invoking bitset is 1. Otherwise it returns false.
4) none function: It returns true if no bits are set.
5) reset function: It is used to clear all the bits.
6) set function: It is used to set the bits.
7) size function: It is used to return number of bits which could be held by a bitset.
8) test function: It is used to find the state of the bits.
9) string to_string function: It is used for finding the bit pattern.
10) long to_ulong function: It is used to convert bits to unsigned long integer.