GF2::Vector::reference — Proxy for Individual Bits

GF2::Vector<Block, Allocator>::reference is a publicly accessible nested class.

It is a proxy that lets users interact with individual elements/bits in a bit-vector. It is needed because normal C++ types cannot target down to the bit level of precision. The primary use of this class is to provide an l-value that can be returned from operator[] and operator().

Member Functions

constructor

The bit-vector methods operator[] and operator() automatically do construction as needed.

operator=

Assigns a bool to the referenced element.

operator bool

Return the value of the referenced element.

set
reset
flip

Sets the referenced element to 1, 0, or flips its value.

operator&=
operator^=
operator|=
operator-=

Logical AND, XOR, OR, and DIFF of the referenced element with a bool on the right hand side of the expression. Changes the value of the referenced element.

operator~

Flips the value of the referenced element from 0 to 1 and vice versa.

See Also

access