Share via


bitset Members

Reference

Constructors

bitset

Constructs an object of class bitset<N> and initializes the bits to zero, to some specified value, or to values obtained from characters in a string.

Typedefs

element_type

A type that is a synonym for the data type bool and can be used to reference element bits in a bitset.

Member Functions

all

Tests all of the bits in this bitset to determine whether they are all set to true.

any

The member function tests whether any bit in the sequence is set to 1.

count

The member function returns the number of bits set in the bit sequence.

flip

Toggles the value of all the bits in a bitset or toggles a single bit at a specified position.

none

Tests if no bit has been set to 1 in a bitset object.

reset

Resets all the bits in a bitset to 0 or resets a bit at a specified position to 0.

set

Sets all the bits in a bitset to 1 or sets a bit at a specified position to 1.

size

Returns the number of bits in a bitset object.

test

Tests whether the bit at a specified position in a bitset is set to 1.

to_string

Converts a bitset object to a string representation.

to_ullong

Returns the sum of the bit values in the bitset as an unsigned long long.

to_ulong

Converts a bitset object to the unsigned long that would generate the sequence of bits contained if used to initialize the bitset.

Member Classes

reference

A proxy class that provides references to bits contained in a bitset that is used to access and manipulate the individual bits as a helper class for the operator[] of class bitset.

Operators

operator!=

Tests a target bitset for inequality with a specified bitset.

operator&=

Performs a bitwise combination of bitsets with the logical AND operation.

operator<<

Shifts the bits in a bitset to the left a specified number of positions and returns the result to a new bitset.

operator<<=

Shifts the bits in a bitset to the left a specified number of positions and returns the result to the targeted bitset.

operator==

Tests a target bitset for equality with a specified bitset.

operator>>

Shifts the bits in a bitset to the right a specified number of positions and returns the result to a new bitset.

operator>>=

Shifts the bits in a bitset to the right a specified number of positions and returns the result to the targeted bitset.

operator[]

Returns a reference to a bit at a specified position in a bitset if the bitset is modifiable; otherwise, it returns the value of the bit at that position.

operator^=

Performs a bitwise combination of bitsets with the exclusive OR operation.

operator|=

Performs a bitwise combination of bitsets with the inclusive OR operation.

operator~

Toggles all the bits in a target bitset and returns the result.

See Also

Reference

bitset Class