6.0.0-rc4Source

QBitRef Class

The QBitRef class is an internal helper for the QBitArray class. More…

Header#include <QBitRef>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes

List of all members, including inherited members

Public Functions

operator bool() const
booloperator!() const
QBitRef &operator=(const QBitRef &v)
QBitRef &operator=(bool v)

Detailed Description

A QBitRef is returned by the non-const operator[]() of QBitArray. It refers to one bit of the array, so that the bit can be both read and assigned with the subscript operator.

QBitArray bits(8);
bits[3] = true;

See also QBitArray.

Differences from Qt

The class is the same as in Qt, but it holds a reference to the array and is invalidated if the array is destroyed.

Member Function Documentation

QBitRef::operator bool() const

Returns the value of the referenced bit.

bool QBitRef::operator!() const

Returns the inverse of the referenced bit.

QBitRef & QBitRef::operator=(const QBitRef &v)

Copies the value of the bit v to the referenced bit and returns a reference to this object.

QBitRef & QBitRef::operator=(bool v)

Sets the referenced bit to v and returns a reference to this object.