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

算术运算接口基类 更多...

#include <inumeric.hpp>

Public 成员函数

MSTL_NODISCARD MSTL_CONSTEXPR14 T operator+ (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator+=(other)))
 加法运算符
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator- (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator-=(other)))
 减法运算符
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator* (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator*=(other)))
 乘法运算符
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator/ (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator/=(other)))
 除法运算符
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator% (const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator%=(other)))
 取模运算符
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator- () const noexcept(noexcept(derived().operator-()))
 一元负号运算符
MSTL_CONSTEXPR14 T & operator+= (const T &other) noexcept(noexcept(derived().operator+=(other)))
 加法赋值运算符
MSTL_CONSTEXPR14 T & operator-= (const T &other) noexcept(noexcept(derived().operator-=(other)))
 减法赋值运算符
MSTL_CONSTEXPR14 T & operator*= (const T &other) noexcept(noexcept(derived().operator*=(other)))
 乘法赋值运算符
MSTL_CONSTEXPR14 T & operator/= (const T &other)
 除法赋值运算符
MSTL_CONSTEXPR14 T & operator%= (const T &other)
 取模赋值运算符
MSTL_CONSTEXPR14 T & operator++ () noexcept(noexcept(derived().operator++()))
 前置自增运算符
MSTL_CONSTEXPR14 T operator++ (int) noexcept(noexcept(derived().operator++()))
 后置自增运算符
MSTL_CONSTEXPR14 T & operator-- () noexcept(noexcept(derived().operator--()))
 前置自减运算符
MSTL_CONSTEXPR14 T operator-- (int) noexcept(noexcept(derived().operator--()))
 后置自减运算符

详细描述

template<typename T>
struct iarithmetic< T >

算术运算接口基类

模板参数
T派生类类型

使用CRTP模式为派生类提供算术运算符的通用实现。 派生类只需实现复合赋值运算符,即可自动获得相应的二元运算符。

在文件 inumeric.hpp30 行定义.

成员函数说明

◆ operator%()

template<typename T>
MSTL_NODISCARD MSTL_CONSTEXPR14 T iarithmetic< T >::operator% ( const T & other) const
inlinenoexcept

取模运算符

参数
other右操作数
返回
两个对象取模的结果

在文件 inumeric.hpp102 行定义.

◆ operator%=()

template<typename T>
MSTL_CONSTEXPR14 T & iarithmetic< T >::operator%= ( const T & other)
inline

取模赋值运算符

参数
other右操作数
返回
当前对象的引用

在文件 inumeric.hpp162 行定义.

◆ operator*()

template<typename T>
MSTL_NODISCARD MSTL_CONSTEXPR14 T iarithmetic< T >::operator* ( const T & other) const
inlinenoexcept

乘法运算符

参数
other右操作数
返回
两个对象相乘的结果

在文件 inumeric.hpp78 行定义.

◆ operator*=()

template<typename T>
MSTL_CONSTEXPR14 T & iarithmetic< T >::operator*= ( const T & other)
inlinenoexcept

乘法赋值运算符

参数
other右操作数
返回
当前对象的引用

在文件 inumeric.hpp143 行定义.

◆ operator+()

template<typename T>
MSTL_NODISCARD MSTL_CONSTEXPR14 T iarithmetic< T >::operator+ ( const T & other) const
inlinenoexcept

加法运算符

参数
other右操作数
返回
两个对象相加的结果

在文件 inumeric.hpp54 行定义.

◆ operator++() [1/2]

template<typename T>
MSTL_CONSTEXPR14 T & iarithmetic< T >::operator++ ( )
inlinenoexcept

前置自增运算符

返回
自增后的对象引用

在文件 inumeric.hpp170 行定义.

◆ operator++() [2/2]

template<typename T>
MSTL_CONSTEXPR14 T iarithmetic< T >::operator++ ( int )
inlinenoexcept

后置自增运算符

返回
自增前的对象副本

在文件 inumeric.hpp179 行定义.

◆ operator+=()

template<typename T>
MSTL_CONSTEXPR14 T & iarithmetic< T >::operator+= ( const T & other)
inlinenoexcept

加法赋值运算符

参数
other右操作数
返回
当前对象的引用

在文件 inumeric.hpp123 行定义.

◆ operator-() [1/2]

template<typename T>
MSTL_NODISCARD MSTL_CONSTEXPR14 T iarithmetic< T >::operator- ( ) const
inlinenoexcept

一元负号运算符

返回
对象的相反数

在文件 inumeric.hpp113 行定义.

◆ operator-() [2/2]

template<typename T>
MSTL_NODISCARD MSTL_CONSTEXPR14 T iarithmetic< T >::operator- ( const T & other) const
inlinenoexcept

减法运算符

参数
other右操作数
返回
两个对象相减的结果

在文件 inumeric.hpp66 行定义.

◆ operator--() [1/2]

template<typename T>
MSTL_CONSTEXPR14 T & iarithmetic< T >::operator-- ( )
inlinenoexcept

前置自减运算符

返回
自减后的对象引用

在文件 inumeric.hpp190 行定义.

◆ operator--() [2/2]

template<typename T>
MSTL_CONSTEXPR14 T iarithmetic< T >::operator-- ( int )
inlinenoexcept

后置自减运算符

返回
自减前的对象副本

在文件 inumeric.hpp199 行定义.

◆ operator-=()

template<typename T>
MSTL_CONSTEXPR14 T & iarithmetic< T >::operator-= ( const T & other)
inlinenoexcept

减法赋值运算符

参数
other右操作数
返回
当前对象的引用

在文件 inumeric.hpp133 行定义.

◆ operator/()

template<typename T>
MSTL_NODISCARD MSTL_CONSTEXPR14 T iarithmetic< T >::operator/ ( const T & other) const
inlinenoexcept

除法运算符

参数
other右操作数
返回
两个对象相除的结果

在文件 inumeric.hpp90 行定义.

◆ operator/=()

template<typename T>
MSTL_CONSTEXPR14 T & iarithmetic< T >::operator/= ( const T & other)
inline

除法赋值运算符

参数
other右操作数
返回
当前对象的引用

在文件 inumeric.hpp153 行定义.


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