boost::dynamic_bitset::reference

A proxy class to simulate lvalues of bit type.

Synopsis

Declared in <boost/dynamic_bitset/dynamic_bitset.hpp>

class reference;

Description

This class exists only as a helper class for dynamic_bitset's operator[]. The following list describes the valid operations on the reference type. Assume that b is an instance of dynamic_bitset, i, j are of size_type and in the range [0, b.size()). Also, note that when we write b[ i ] we mean an object of type reference that was initialized from b[ i ]. The variable x is a bool.

(bool)b[ i ]

Returns the i‐th bit of b.

(bool)~ b[ i ]

Returns the opposite of the i‐th bit of b.

b[ i ].flip()

Flips the i‐th bit of b and returns b[ i ].

x = b[ i ]

Assigns the i‐th bit of b to x.

b[ i ] = x

Sets the i‐th bit of b to the value of x and returns b[ i ].

b[ i ] = b[ j ]

Sets the i‐th bit of b to the value of the j‐th bit of b and returns b[ i ].

b[ i ] |= x

Does an OR of the i‐th bit of b with the value of x and returns b[ i ].

b[ i ] &= x

Does an AND of the i‐th bit of b with the value of x and returns b[ i ].

b[ i ] ˆ= x

Does a XOR of the i‐th bit of b with the value of x and returns b[ i ].

b[ i ] ‐= x

If x is true, clears the i‐th bit of b. Returns b[ i ].

b[ i ] |= b[ j ]

Does an OR of the i‐th bit of b with the j‐th bit of b and returns b[ i ].

b[ i ] &= b[ j ]

Does an AND of the i‐th bit of b with the j‐th bit of b and returns b[ i ].

b[ i ] ˆ= b[ j ]

Does a XOR of the i‐th bit of b with the j‐th bit of b and returns b[ i ].

b[ i ] ‐= b[ j ]

If the j‐th bit of b is set, clears the i‐th bit of b. Returns b[ i ].

Member Functions

Name

Description

reference [constructor]

Copy constructor.

operator=

See the class description.

flip

See the class description.

operator& [deleted]

Deleted address‐of operator.

operator&=

See the class description.

operator‐=

See the class description.

operatorˆ=

See the class description.

operator|=

See the class description.

operator~

See the class description.

operator bool

See the class description.

Friends

Name Description

boost::bit_iterator

boost::dynamic_bitset

The dynamic_bitset template represents a set of bits.

Created with MrDocs