1#ifndef NEFORCE_CORE_INTERFACE_INUMERIC_HPP__
2#define NEFORCE_CORE_INTERFACE_INUMERIC_HPP__
13NEFORCE_BEGIN_NAMESPACE__
36 constexpr const T& derived()
const noexcept {
return static_cast<const T&
>(*this); }
42 constexpr T& derived()
noexcept {
return static_cast<T&
>(*this); }
50 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator+(
const T& other)
const
51 noexcept(
noexcept(
const_cast<T&
>(derived()).operator+=(other))) {
62 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator-(
const T& other)
const
63 noexcept(
noexcept(
const_cast<T&
>(derived()).operator-=(other))) {
74 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator*(
const T& other)
const
75 noexcept(
noexcept(
const_cast<T&
>(derived()).operator*=(other))) {
86 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator/(
const T& other)
const
87 noexcept(
noexcept(
const_cast<T&
>(derived()).operator/=(other))) {
98 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator%(
const T& other)
const
99 noexcept(
noexcept(
const_cast<T&
>(derived()).operator%=(other))) {
109 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator-() const noexcept(noexcept(derived().operator-())) {
110 return derived().operator-();
118 NEFORCE_CONSTEXPR14 T&
operator+=(
const T& other)
noexcept(
noexcept(derived().operator+=(other))) {
119 return derived().operator+=(other);
127 NEFORCE_CONSTEXPR14 T&
operator-=(
const T& other)
noexcept(
noexcept(derived().operator-=(other))) {
128 return derived().operator-=(other);
136 NEFORCE_CONSTEXPR14 T&
operator*=(
const T& other)
noexcept(
noexcept(derived().operator*=(other))) {
137 return derived().operator*=(other);
145 NEFORCE_CONSTEXPR14 T&
operator/=(
const T& other) {
return derived().operator/=(other); }
152 NEFORCE_CONSTEXPR14 T&
operator%=(
const T& other) {
return derived().operator%=(other); }
158 NEFORCE_CONSTEXPR14 T&
operator++() noexcept(noexcept(derived().operator++())) {
return derived().operator++(); }
164 NEFORCE_CONSTEXPR14 T
operator++(
int)
noexcept(
noexcept(derived().operator++())) {
174 NEFORCE_CONSTEXPR14 T&
operator--() noexcept(noexcept(derived().operator--())) {
return derived().operator--(); }
180 NEFORCE_CONSTEXPR14 T
operator--(
int)
noexcept(
noexcept(derived().operator--())) {
203 constexpr const T& derived()
const noexcept {
return static_cast<const T&
>(*this); }
209 constexpr T& derived()
noexcept {
return static_cast<T&
>(*this); }
217 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator&(
const T& other)
const
218 noexcept(
noexcept(
const_cast<T&
>(derived()).operator&=(other))) {
229 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator|(
const T& other)
const
230 noexcept(
noexcept(
const_cast<T&
>(derived()).operator|=(other))) {
241 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator^(
const T& other)
const
242 noexcept(
noexcept(
const_cast<T&
>(derived()).operator^=(other))) {
252 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator~() const noexcept(noexcept(derived().operator~())) {
253 return derived().operator~();
282 NEFORCE_CONSTEXPR14 T&
operator&=(
const T& other)
noexcept(
noexcept(derived().operator&=(other))) {
283 return derived().operator&=(other);
291 NEFORCE_CONSTEXPR14 T&
operator|=(
const T& other)
noexcept(
noexcept(derived().operator|=(other))) {
292 return derived().operator|=(other);
300 NEFORCE_CONSTEXPR14 T&
operator^=(
const T& other)
noexcept(
noexcept(derived().operator^=(other))) {
301 return derived().operator^=(other);
321NEFORCE_END_NAMESPACE__
unsigned int uint32_t
32位无符号整数类型
NEFORCE_CONSTEXPR14 T & operator%=(const T &other)
取模赋值运算符
NEFORCE_CONSTEXPR14 T & operator--() noexcept(noexcept(derived().operator--()))
前置自减运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator%(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator%=(other)))
取模运算符
NEFORCE_CONSTEXPR14 T & operator*=(const T &other) noexcept(noexcept(derived().operator*=(other)))
乘法赋值运算符
NEFORCE_CONSTEXPR14 T & operator++() noexcept(noexcept(derived().operator++()))
前置自增运算符
NEFORCE_CONSTEXPR14 T & operator-=(const T &other) noexcept(noexcept(derived().operator-=(other)))
减法赋值运算符
NEFORCE_CONSTEXPR14 T operator--(int) noexcept(noexcept(derived().operator--()))
后置自减运算符
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_CONSTEXPR14 T & operator/=(const T &other)
除法赋值运算符
NEFORCE_CONSTEXPR14 T & operator+=(const T &other) noexcept(noexcept(derived().operator+=(other)))
加法赋值运算符
NEFORCE_CONSTEXPR14 T operator++(int) noexcept(noexcept(derived().operator++()))
后置自增运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator-() const noexcept(noexcept(derived().operator-()))
一元负号运算符
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_CONSTEXPR14 T & operator|=(const T &other) noexcept(noexcept(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 T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator|=(other)))
按位或运算符
NEFORCE_CONSTEXPR14 T & operator>>=(const uint32_t shift)
右移赋值运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator<<(const uint32_t shift) const
左移运算符
NEFORCE_CONSTEXPR14 T & operator^=(const T &other) noexcept(noexcept(derived().operator^=(other)))
按位异或赋值运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator^(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator^=(other)))
按位异或运算符
NEFORCE_CONSTEXPR14 T & operator<<=(const uint32_t shift)
左移赋值运算符
NEFORCE_CONSTEXPR14 T & operator&=(const T &other) noexcept(noexcept(derived().operator&=(other)))
按位与赋值运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T operator&(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator&=(other)))
按位与运算符