NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
ipackage< T, PackageT > 模板结构体 参考

基础数值包装接口 更多...

#include <ipackage.hpp>

类 ipackage< T, PackageT > 继承关系图:
[图例]

Public 类型

using package_type = PackageT
 包装类型

Public 成员函数

constexpr ipackage (package_type value) noexcept
 构造函数
NEFORCE_NODISCARD constexpr operator package_type () const noexcept
 类型转换操作符
NEFORCE_NODISCARD constexpr package_type value () const noexcept
 获取数值
NEFORCE_NODISCARD constexpr int64_t to_int64 () const noexcept
 转换为64位整数
NEFORCE_NODISCARD constexpr size_t to_hash () const noexcept
 计算哈希值
constexpr void swap (T &other) noexcept
 交换内容
NEFORCE_NODISCARD constexpr bool operator== (const T &other) const noexcept
 相等比较操作符
NEFORCE_NODISCARD constexpr bool operator< (const T &other) const noexcept
 小于比较操作符
constexpr T & operator+= (const T &other) noexcept
 加法赋值操作符
constexpr T & operator-= (const T &other) noexcept
 减法赋值操作符
constexpr T & operator*= (const T &other) noexcept
 乘法赋值操作符
constexpr T & operator/= (const T &other)
 除法赋值操作符
constexpr T & operator%= (const T &other)
 取模赋值操作符
NEFORCE_NODISCARD constexpr T operator- () const noexcept
 一元负号操作符
constexpr T & operator++ () noexcept
 前置递增操作符
constexpr T & operator-- () noexcept
 前置递减操作符
constexpr T operator~ () const noexcept
 按位取反操作符
constexpr T & operator&= (const T &other) noexcept
 按位与赋值操作符
constexpr T & operator|= (const T &other) noexcept
 按位或赋值操作符
constexpr T & operator^= (const T &other) noexcept
 按位异或赋值操作符
constexpr T & operator<<= (const uint32_t shift)
 左移赋值操作符
constexpr T & operator>>= (const uint32_t shift)
 右移赋值操作符
Public 成员函数 继承自 icomparable< T >
NEFORCE_NODISCARD constexpr bool operator== (const T &rhs) const noexcept(noexcept(derived()==rhs))
 相等比较运算符
NEFORCE_NODISCARD constexpr bool operator!= (const T &rhs) const noexcept(noexcept(!(*this==rhs)))
 不等比较运算符
NEFORCE_NODISCARD constexpr bool operator< (const T &rhs) const noexcept(noexcept(derived()< rhs))
 小于比较运算符
NEFORCE_NODISCARD constexpr bool operator> (const T &rhs) const noexcept(noexcept(rhs< derived()))
 大于比较运算符
NEFORCE_NODISCARD constexpr bool operator<= (const T &rhs) const noexcept(noexcept(!(derived() > rhs)))
 小于等于比较运算符
NEFORCE_NODISCARD constexpr bool operator>= (const T &rhs) const noexcept(noexcept(!(derived()< rhs)))
 大于等于比较运算符
Public 成员函数 继承自 ihashable< T >
NEFORCE_NODISCARD constexpr size_t to_hash () const noexcept(noexcept(derived().to_hash()))
 获取对象的哈希值
Public 成员函数 继承自 iarithmetic< T >
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator+ (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator+=(other)))
 加法运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator- (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator-=(other)))
 减法运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator* (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator*=(other)))
 乘法运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator/ (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator/=(other)))
 除法运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator% (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator%=(other)))
 取模运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator- () const noexcept(noexcept(derived().operator-()))
 一元负号运算符
NEFORCE_CONSTEXPR14 T & operator+= (const T &other) noexcept(noexcept(derived().operator+=(other)))
 加法赋值运算符
NEFORCE_CONSTEXPR14 T & operator-= (const T &other) noexcept(noexcept(derived().operator-=(other)))
 减法赋值运算符
NEFORCE_CONSTEXPR14 T & operator*= (const T &other) noexcept(noexcept(derived().operator*=(other)))
 乘法赋值运算符
NEFORCE_CONSTEXPR14 T & operator/= (const T &other)
 除法赋值运算符
NEFORCE_CONSTEXPR14 T & operator%= (const T &other)
 取模赋值运算符
NEFORCE_CONSTEXPR14 T & operator++ () noexcept(noexcept(derived().operator++()))
 前置自增运算符
NEFORCE_CONSTEXPR14 T operator++ (int) noexcept(noexcept(derived().operator++()))
 后置自增运算符
NEFORCE_CONSTEXPR14 T & operator-- () noexcept(noexcept(derived().operator--()))
 前置自减运算符
NEFORCE_CONSTEXPR14 T operator-- (int) noexcept(noexcept(derived().operator--()))
 后置自减运算符
Public 成员函数 继承自 ibinary< T >
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator& (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator&=(other)))
 按位与运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator| (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator|=(other)))
 按位或运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator^ (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator^=(other)))
 按位异或运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator~ () const noexcept(noexcept(derived().operator~()))
 按位取反运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator<< (const uint32_t shift) const
 左移运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator>> (const uint32_t shift) const
 右移运算符
NEFORCE_CONSTEXPR14 T & operator&= (const T &other) noexcept(noexcept(derived().operator&=(other)))
 按位与赋值运算符
NEFORCE_CONSTEXPR14 T & operator|= (const T &other) noexcept(noexcept(derived().operator|=(other)))
 按位或赋值运算符
NEFORCE_CONSTEXPR14 T & operator^= (const T &other) noexcept(noexcept(derived().operator^=(other)))
 按位异或赋值运算符
NEFORCE_CONSTEXPR14 T & operator<<= (const uint32_t shift)
 左移赋值运算符
NEFORCE_CONSTEXPR14 T & operator>>= (const uint32_t shift)
 右移赋值运算符

静态 Public 成员函数

static NEFORCE_NODISCARD constexpr size_t bytes () noexcept
 获取类型字节大小
static NEFORCE_NODISCARD constexpr size_t bits () noexcept
 获取类型位大小

Protected 成员函数

NEFORCE_CONSTEXPR20 ~ipackage ()=default
 受保护的析构函数

Protected 属性

package_type value_ {static_cast<package_type>(0)}
 存储的数值

详细描述

template<typename T, typename PackageT>
struct ipackage< T, PackageT >

基础数值包装接口

模板参数
T派生类类型
PackageT包装的数值类型

提供数值类型的通用接口,包括算术运算、位运算和比较操作。

注解
PackageT必须是算术类型。

在文件 ipackage.hpp33 行定义.

构造及析构函数说明

◆ ipackage()

template<typename T, typename PackageT>
ipackage< T, PackageT >::ipackage ( package_type value)
inlineexplicitconstexprnoexcept

构造函数

参数
value初始数值

使用指定数值构造包装对象。

在文件 ipackage.hpp70 行定义.

◆ ~ipackage()

template<typename T, typename PackageT>
NEFORCE_CONSTEXPR20 ipackage< T, PackageT >::~ipackage ( )
protecteddefault

受保护的析构函数

防止通过基类指针删除派生类对象。

成员函数说明

◆ bits()

template<typename T, typename PackageT>
NEFORCE_NODISCARD constexpr size_t ipackage< T, PackageT >::bits ( )
inlinestaticconstexprnoexcept

获取类型位大小

返回
包装类型占用的位数

在文件 ipackage.hpp110 行定义.

◆ bytes()

template<typename T, typename PackageT>
NEFORCE_NODISCARD constexpr size_t ipackage< T, PackageT >::bytes ( )
inlinestaticconstexprnoexcept

获取类型字节大小

返回
包装类型占用的字节数

在文件 ipackage.hpp104 行定义.

◆ operator package_type()

template<typename T, typename PackageT>
NEFORCE_NODISCARD constexpr ipackage< T, PackageT >::operator package_type ( ) const
inlineexplicitconstexprnoexcept

类型转换操作符

返回
转换为包装类型的数值

在文件 ipackage.hpp86 行定义.

◆ operator%=()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator%= ( const T & other)
inlineconstexpr

取模赋值操作符

参数
other右侧对象
返回
自身引用
异常
math_exception除数为0时

在文件 ipackage.hpp188 行定义.

◆ operator&=()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator&= ( const T & other)
inlineconstexprnoexcept

按位与赋值操作符

参数
other右侧对象
返回
自身引用

在文件 ipackage.hpp228 行定义.

◆ operator*=()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator*= ( const T & other)
inlineconstexprnoexcept

乘法赋值操作符

参数
other右侧对象
返回
自身引用

在文件 ipackage.hpp163 行定义.

◆ operator++()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator++ ( )
inlineconstexprnoexcept

前置递增操作符

返回
递增后的自身引用

在文件 ipackage.hpp203 行定义.

◆ operator+=()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator+= ( const T & other)
inlineconstexprnoexcept

加法赋值操作符

参数
other右侧对象
返回
自身引用

在文件 ipackage.hpp143 行定义.

◆ operator-()

template<typename T, typename PackageT>
NEFORCE_NODISCARD constexpr T ipackage< T, PackageT >::operator- ( ) const
inlineconstexprnoexcept

一元负号操作符

返回
取负后的新对象

在文件 ipackage.hpp197 行定义.

◆ operator--()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator-- ( )
inlineconstexprnoexcept

前置递减操作符

返回
递减后的自身引用

在文件 ipackage.hpp212 行定义.

◆ operator-=()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator-= ( const T & other)
inlineconstexprnoexcept

减法赋值操作符

参数
other右侧对象
返回
自身引用

在文件 ipackage.hpp153 行定义.

◆ operator/=()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator/= ( const T & other)
inlineconstexpr

除法赋值操作符

参数
other右侧对象
返回
自身引用
异常
math_exception除数为0时

在文件 ipackage.hpp174 行定义.

◆ operator<()

template<typename T, typename PackageT>
NEFORCE_NODISCARD constexpr bool ipackage< T, PackageT >::operator< ( const T & other) const
inlineconstexprnoexcept

小于比较操作符

参数
other右侧对象
返回
当前对象的数值是否小于右侧对象的数值

在文件 ipackage.hpp136 行定义.

◆ operator<<=()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator<<= ( const uint32_t shift)
inlineconstexpr

左移赋值操作符

参数
shift移位位数
返回
自身引用
异常
value_exception移位位数超出范围时抛出

在文件 ipackage.hpp259 行定义.

◆ operator==()

template<typename T, typename PackageT>
NEFORCE_NODISCARD constexpr bool ipackage< T, PackageT >::operator== ( const T & other) const
inlineconstexprnoexcept

相等比较操作符

参数
other右侧对象
返回
两个对象的数值是否相等

在文件 ipackage.hpp129 行定义.

◆ operator>>=()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator>>= ( const uint32_t shift)
inlineconstexpr

右移赋值操作符

参数
shift移位位数
返回
自身引用
异常
value_exception移位位数超出范围时抛出

在文件 ipackage.hpp273 行定义.

◆ operator^=()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator^= ( const T & other)
inlineconstexprnoexcept

按位异或赋值操作符

参数
other右侧对象
返回
自身引用

在文件 ipackage.hpp248 行定义.

◆ operator|=()

template<typename T, typename PackageT>
T & ipackage< T, PackageT >::operator|= ( const T & other)
inlineconstexprnoexcept

按位或赋值操作符

参数
other右侧对象
返回
自身引用

在文件 ipackage.hpp238 行定义.

◆ operator~()

template<typename T, typename PackageT>
T ipackage< T, PackageT >::operator~ ( ) const
inlineconstexprnoexcept

按位取反操作符

返回
按位取反后的新对象

在文件 ipackage.hpp221 行定义.

◆ swap()

template<typename T, typename PackageT>
void ipackage< T, PackageT >::swap ( T & other)
inlineconstexprnoexcept

交换内容

参数
other要交换的另一个对象

在文件 ipackage.hpp122 行定义.

被这些函数引用 ipackage< integer8, int8_t >::swap().

◆ to_hash()

template<typename T, typename PackageT>
NEFORCE_NODISCARD constexpr size_t ipackage< T, PackageT >::to_hash ( ) const
inlineconstexprnoexcept

计算哈希值

返回
数值的哈希值

在文件 ipackage.hpp116 行定义.

◆ to_int64()

template<typename T, typename PackageT>
NEFORCE_NODISCARD constexpr int64_t ipackage< T, PackageT >::to_int64 ( ) const
inlineconstexprnoexcept

转换为64位整数

返回
转换为int64_t的数值

在文件 ipackage.hpp98 行定义.

◆ value()

template<typename T, typename PackageT>
NEFORCE_NODISCARD constexpr package_type ipackage< T, PackageT >::value ( ) const
inlineconstexprnoexcept

获取数值

返回
存储的数值

在文件 ipackage.hpp92 行定义.

被这些函数引用 icharacter< character, char >::icharacter() , 以及 color::parse().


该结构体的文档由以下文件生成: