1#ifndef MSTL_CORE_INTERFACE_INUMERIC_HPP__
2#define MSTL_CORE_INTERFACE_INUMERIC_HPP__
36 constexpr const T& derived()
const noexcept {
37 return static_cast<const T&
>(*this);
44 constexpr T& derived()
noexcept {
45 return static_cast<T&
>(*this);
54 MSTL_NODISCARD MSTL_CONSTEXPR14 T
operator +(
const T& other)
const
55 noexcept(
noexcept(
const_cast<T&
>(derived()).operator+=(other))) {
66 MSTL_NODISCARD MSTL_CONSTEXPR14 T
operator -(
const T& other)
const
67 noexcept(
noexcept(
const_cast<T&
>(derived()).operator-=(other))) {
78 MSTL_NODISCARD MSTL_CONSTEXPR14 T
operator *(
const T& other)
const
79 noexcept(
noexcept(
const_cast<T&
>(derived()).operator*=(other))) {
90 MSTL_NODISCARD MSTL_CONSTEXPR14 T
operator /(
const T& other)
const
91 noexcept(
noexcept(
const_cast<T&
>(derived()).operator/=(other))) {
102 MSTL_NODISCARD MSTL_CONSTEXPR14 T
operator %(
const T& other)
const
103 noexcept(
noexcept(
const_cast<T&
>(derived()).operator%=(other))) {
114 noexcept(noexcept(derived().operator-())) {
115 return derived().operator-();
124 noexcept(
noexcept(derived().operator+=(other))) {
125 return derived().operator+=(other);
134 noexcept(
noexcept(derived().operator-=(other))) {
135 return derived().operator-=(other);
144 noexcept(
noexcept(derived().operator*=(other))) {
145 return derived().operator*=(other);
154 return derived().operator/=(other);
163 return derived().operator%=(other);
171 noexcept(noexcept(derived().operator++())) {
172 return derived().operator++();
180 noexcept(
noexcept(derived().operator++())) {
191 noexcept(noexcept(derived().operator--())) {
192 return derived().operator--();
200 noexcept(
noexcept(derived().operator--())) {
223 constexpr const T& derived()
const noexcept {
224 return static_cast<const T&
>(*this);
231 constexpr T& derived()
noexcept {
232 return static_cast<T&
>(*this);
241 MSTL_NODISCARD MSTL_CONSTEXPR14 T
operator &(
const T& other)
const
242 noexcept(
noexcept(
const_cast<T&
>(derived()).operator&=(other))) {
253 MSTL_NODISCARD MSTL_CONSTEXPR14 T
operator |(
const T& other)
const
254 noexcept(
noexcept(
const_cast<T&
>(derived()).operator|=(other))) {
265 MSTL_NODISCARD MSTL_CONSTEXPR14 T
operator ^(
const T& other)
const
266 noexcept(
noexcept(
const_cast<T&
>(derived()).operator^=(other))) {
277 noexcept(noexcept(derived().operator~())) {
278 return derived().operator~();
308 noexcept(
noexcept(derived().operator&=(other))) {
309 return derived().operator&=(other);
318 noexcept(
noexcept(derived().operator|=(other))) {
319 return derived().operator|=(other);
328 noexcept(
noexcept(derived().operator^=(other))) {
329 return derived().operator^=(other);
338 return derived().operator<<=(shift);
347 return derived().operator>>=(shift);
unsigned int uint32_t
32位无符号整数类型
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator-() const noexcept(noexcept(derived().operator-()))
一元负号运算符
MSTL_CONSTEXPR14 T & operator%=(const T &other)
取模赋值运算符
MSTL_CONSTEXPR14 T & operator-=(const T &other) noexcept(noexcept(derived().operator-=(other)))
减法赋值运算符
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator/(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator/=(other)))
除法运算符
MSTL_CONSTEXPR14 T & operator+=(const T &other) noexcept(noexcept(derived().operator+=(other)))
加法赋值运算符
MSTL_CONSTEXPR14 T & operator--() noexcept(noexcept(derived().operator--()))
前置自减运算符
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator+(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator+=(other)))
加法运算符
MSTL_CONSTEXPR14 T & operator++() noexcept(noexcept(derived().operator++()))
前置自增运算符
MSTL_CONSTEXPR14 T & operator*=(const T &other) noexcept(noexcept(derived().operator*=(other)))
乘法赋值运算符
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator%(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator%=(other)))
取模运算符
MSTL_CONSTEXPR14 T & operator/=(const T &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_CONSTEXPR14 T & operator|=(const T &other) noexcept(noexcept(derived().operator|=(other)))
按位或赋值运算符
MSTL_CONSTEXPR14 T & operator^=(const T &other) noexcept(noexcept(derived().operator^=(other)))
按位异或赋值运算符
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator|(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator|=(other)))
按位或运算符
MSTL_CONSTEXPR14 T & operator<<=(const uint32_t shift)
左移赋值运算符
MSTL_CONSTEXPR14 T & operator&=(const T &other) noexcept(noexcept(derived().operator&=(other)))
按位与赋值运算符
MSTL_NODISCARD MSTL_CONSTEXPR14 T operator>>(const uint32_t shift) const
右移运算符
MSTL_CONSTEXPR14 T & operator>>=(const uint32_t shift)
右移赋值运算符
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_NODISCARD MSTL_CONSTEXPR14 T operator<<(const uint32_t shift) const
左移运算符