QBEInteger Class

template <typename T> class QBEInteger

QBEInteger 类提供与平台无关的大二进制整数。更多

头文件: #include <QBEInteger>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

公共函数

QBEInteger(T value)
T operator T() const
bool operator!=(QBEInteger<T> other) const
QBEInteger<T> &operator%=(T i)
QBEInteger<T> &operator&=(T i)
QBEInteger<T> &operator*=(T i)
QBEInteger<T> &operator++()
QBEInteger<T> operator++(int)
QBEInteger<T> &operator+=(T i)
QBEInteger<T> &operator--()
QBEInteger<T> operator--(int)
QBEInteger<T> &operator-=(T i)
QBEInteger<T> &operator/=(T i)
QBEInteger<T> &operator<<=(T i)
QBEInteger<T> &operator=(T i)
bool operator==(QBEInteger<T> other) const
QBEInteger<T> &operator>>=(T i)
QBEInteger<T> &operator^=(T i)
QBEInteger<T> &operator|=(T i)

静态公共成员

QBEInteger<T> max()
QBEInteger<T> min()

详细说明

模板参数T 必须是 C++ 整数类型:

  • 8 位:char、有符号 char、无符号 char、qint8、quint8
  • 16 位:short、无符号 short、qint16、quint16、char16_t
  • 32 位:int、无符号 int、qint32、quint32、char32_t
  • 64 位:long long、无符号 long long、qint64、quint64
  • 特定平台大小:long、无符号 long
  • 指针大小:qintptr、quintptr、qptrdiff

注意: 使用该类可能会比使用本地整数慢,因此只有在需要精确的内码时才会使用。

成员函数文档

[explicit constexpr] QBEInteger::QBEInteger(T value)

用给定的value 构建一个 QBEInteger。

[static constexpr] QBEInteger<T> QBEInteger::max()

返回数值类型 T 可表示的最大(有限)值。

[static constexpr] QBEInteger<T> QBEInteger::min()

返回数值类型 T 可表示的最小(有限)值。

T QBEInteger::operator T() const

以本地整数形式返回QBEInteger 的值。

bool QBEInteger::operator!=(QBEInteger<T> other) const

如果QBEInteger 的值不等于other 的值,则返回true

QBEInteger<T> &QBEInteger::operator%=(T i)

QBEInteger 设置为除以i 的余数,并返回此对象的引用。

QBEInteger<T> &QBEInteger::operator&=(T i)

i 上执行与QBEInteger 的位和运算,并返回对该对象的引用。

QBEInteger<T> &QBEInteger::operator*=(T i)

i 与此QBEInteger 相乘,并返回此对象的引用。

QBEInteger<T> &QBEInteger::operator++()

QBEInteger 执行前缀++ (递增)操作,并返回对该对象的引用。

QBEInteger<T> QBEInteger::operator++(int)

QBEInteger 执行后缀++ (递增),并返回对该对象的引用。

QBEInteger<T> &QBEInteger::operator+=(T i)

i 添加到QBEInteger ,并返回对该对象的引用。

QBEInteger<T> &QBEInteger::operator--()

QBEInteger 执行前缀-- (递减)操作,并返回对该对象的引用。

QBEInteger<T> QBEInteger::operator--(int)

QBEInteger 执行后缀-- (递减),并返回对该对象的引用。

QBEInteger<T> &QBEInteger::operator-=(T i)

i 减去QBEInteger ,并返回对该对象的引用。

QBEInteger<T> &QBEInteger::operator/=(T i)

QBEIntegeri 进行分割,并返回此对象的引用。

QBEInteger<T> &QBEInteger::operator<<=(T i)

通过iQBEInteger 执行右移,并返回此对象的引用。

QBEInteger<T> &QBEInteger::operator=(T i)

i 赋值给此QBEInteger ,并返回对QBEInteger 的引用。

bool QBEInteger::operator==(QBEInteger<T> other) const

如果QBEInteger 的值等于other 的值,则返回true

QBEInteger<T> &QBEInteger::operator>>=(T i)

通过iQBEInteger 执行左移,并返回此对象的引用。

QBEInteger<T> &QBEInteger::operator^=(T i)

iQBEInteger 执行位向 XOR,并返回对该对象的引用。

QBEInteger<T> &QBEInteger::operator|=(T i)

i 上对QBEInteger 执行位操作 OR,并返回对该对象的引用。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.