QLEInteger Class

template <typename T> class QLEInteger

QLEInteger 类提供与平台无关的小指整数。更多

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

公共函数

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

静态公共成员

QLEInteger<T> max()
QLEInteger<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] QLEInteger::QLEInteger(T value)

用给定的value 构造一个 QLEInteger。

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

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

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

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

T QLEInteger::operator T() const

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

i 上对QLEInteger 执行位操作 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.